Function: activities-tabs--switch-buffer
activities-tabs--switch-buffer is an interactive and byte-compiled
function defined in activities-tabs.el.
Signature
(activities-tabs--switch-buffer ACTIVITY)
Documentation
Switch to a buffer associated with ACTIVITY.
Interactively, select from buffers associated with ACTIVITY; or, with prefix argument, choose another activity.
Key Bindings
Source Code
;; Defined in ~/.emacs.d/elpa/activities-0.7.2/activities-tabs.el
;;;; Commands
(defun activities-tabs--switch-buffer (activity)
"Switch to a buffer associated with ACTIVITY.
Interactively, select from buffers associated with ACTIVITY; or,
with prefix argument, choose another activity."
(interactive
(list (if current-prefix-arg
(activities-completing-read)
(or (activities-current) (activities-completing-read)))))
;; Much code borrowed from `read-buffer-to-switch', which see.
(let* ((tab (activities-tabs--tab activity))
(activity-buffers (activities-tabs--tab-parameter 'activities-buffer-list tab))
(current-buffer-name (buffer-name (current-buffer)))
(rbts-completion-table
(apply-partially
#'completion-table-with-predicate
#'internal-complete-buffer
(lambda (buffer-name)
(let ((buffer-name (if (consp buffer-name) (car buffer-name) buffer-name)))
(and (not (equal buffer-name current-buffer-name))
(cl-member buffer-name activity-buffers :key #'buffer-name))))
nil))
(selected-buffer
(minibuffer-with-setup-hook
(lambda ()
(setq-local minibuffer-completion-table rbts-completion-table)
(if (and (boundp 'icomplete-with-completion-tables)
(listp icomplete-with-completion-tables))
(setq-local icomplete-with-completion-tables
(cons rbts-completion-table
icomplete-with-completion-tables))))
(read-buffer "Switch to activity buffer:" (other-buffer (current-buffer))
(confirm-nonexistent-file-or-buffer)))))
(switch-to-buffer selected-buffer)))