help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

seq-filter or delete-dups or ignore?


From: Corwin Brust
Subject: seq-filter or delete-dups or ignore?
Date: Fri, 29 Jan 2021 00:32:38 -0600

Given ERC doesn't currently import seq.el, consider some following
possible implementations of a command to stop tracking the current
buffer by adding its name to `erc-track-ignore'.

Are there compelling reasons to prefer one among them, or another
approach?  I also noticed `delete-duplicates' from cl-lib however I
didn't see any reason to prefer it to delete dups, which as part of
subr can be assumed to be available by the time ERC is loaded.

Aniceliery suggestions that otherwise improve the approach here are
most welcome also :)

#+NAME delete-dups
#+BEGIN_SRC emacs-lisp
(defun erc-cmd-UNTRACK (&optional target)
  "Stop tracking TARGET (or current channel)."
  (interactive)
  (let ((target (or target (buffer-name))))
    (setq erc-track-exclude (append (list target)))
    (delete-dups erc-track-exclude)))
#+END_SRC

#+NAME req-seq
#+BEGIN_SRC emacs-lisp
(defun erc-cmd-UNTRACK (&optional target)
  "Stop tracking TARGET (or current channel)."
  (interactive)
  (let ((target (or target (buffer-name))))
    (setq erc-track-exclude
             (seq-uniq (append (list target)
                                            erc-track-exclude)))))
#+END_SRC

#+NAME append-remove
#+BEGIN_SRC emacs-lisp
(defun erc-cmd-UNTRACK (&optional target)
   "Stop tracking TARGET (or current channel)."
   (interactive)
   (let ((target (or target (buffer-name))))
     (setq erc-track-exclude
              (append (list target)
                            (remove target erc-track-exclude)))))
#+END_SRC

Thanks & regards,
Corwin



reply via email to

[Prev in Thread] Current Thread [Next in Thread]