[Top][All Lists]

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

RE: Cycle Org Shift Select

From: Drew Adams
Subject: RE: Cycle Org Shift Select
Date: Tue, 10 Nov 2020 08:37:26 -0800 (PST)

> (defun Org-Shftsel-Cycle ()
>   (interactive)
>   (setq org-support-shift-select
>         (cadr (memq org-support-shift-select '(nil t always nil)))))

Elegant Lisp, IMO!  A good idiom.

Slightly cuter: the last nil isn't needed, since (car nil) = nil.

(defvar toto nil)

(defun foo ()
  (setq toto  (cadr (memq toto '(nil t always))))
  (message "NOW: %s" toto))

Of if you want to show also what'll come next:

(defun foo ()
  (let ((xs  '(nil t always))
    (setq toto  (cadr (memq toto xs))
          next  (cadr (memq toto xs)))
    (message "NOW: %s, NEXT: %s" toto next)))

reply via email to

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