Function: erc-track-get-active-buffer

erc-track-get-active-buffer is a byte-compiled function defined in erc-track.el.gz.

Signature

(erc-track-get-active-buffer ARG)

Documentation

Return the buffer name of ARG in erc-modified-channels-alist.

Negative arguments index in the opposite direction. This direction is relative to erc-track-switch-direction.

Source Code

;; Defined in /usr/src/emacs/lisp/erc/erc-track.el.gz
(defun erc-track-get-active-buffer (arg)
  "Return the buffer name of ARG in `erc-modified-channels-alist'.
Negative arguments index in the opposite direction.  This direction
is relative to `erc-track-switch-direction'."
  (let ((dir erc-track-switch-direction)
	offset)
    (when (< arg 0)
      (setq dir (pcase dir
		  ('oldest      'newest)
		  ('newest      'oldest)
		  ('mostactive  'leastactive)
		  ('leastactive 'mostactive)
		  ('importance  'oldest)))
      (setq arg (- arg)))
    (setq offset (pcase dir
		   ((or 'oldest 'leastactive)
		    (- (length erc-modified-channels-alist) arg))
		   (_ (1- arg))))
    ;; normalize out of range user input
    (cond ((>= offset (length erc-modified-channels-alist))
	   (setq offset (1- (length erc-modified-channels-alist))))
	  ((< offset 0)
	   (setq offset 0)))
    (car (nth offset erc-modified-channels-alist))))