all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* seq-filter or delete-dups or ignore?
@ 2021-01-29  6:32 Corwin Brust
  0 siblings, 0 replies; only message in thread
From: Corwin Brust @ 2021-01-29  6:32 UTC (permalink / raw)
  To: Help Gnu Emacs mailing list

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



^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-01-29  6:32 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-01-29  6:32 seq-filter or delete-dups or ignore? Corwin Brust

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.