[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: |
Wed, 11 Nov 2020 09:09:25 -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 ()
> (interactive)
> (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 ()
> (interactive)
> (let ((xs '(nil t always))
> next)
> (setq toto (cadr (memq toto xs))
> next (cadr (memq toto xs)))
> (message "NOW: %s, NEXT: %s" toto next)))
On the other hand, if you want to be able to go either
forward or backward then you might want to use a ring
(as defined in standard library ring.el):
(defvar ring (ring-convert-sequence-to-ring '(nil t always)))
(defvar current nil)
(defun next ()
(interactive)
(setq current (ring-next toto current))
(message "NOW: %s" current))
(defun previous ()
(interactive)
(setq current (ring-previous toto current))
(message "NOW: %s" current))
- Re: Cycle Org Shift Select, (continued)
- Re: Cycle Org Shift Select, Michael Heerdegen, 2020/11/09
- Re: Cycle Org Shift Select, Christopher Dimech, 2020/11/09
- Re: Cycle Org Shift Select, Noam Postavsky, 2020/11/09
- Re: Cycle Org Shift Select, Michael Heerdegen, 2020/11/09
- Re: Cycle Org Shift Select, Christopher Dimech, 2020/11/09
- Re: Cycle Org Shift Select, Christopher Dimech, 2020/11/09
- Re: Cycle Org Shift Select, tomas, 2020/11/10
- Re: Cycle Org Shift Select, Christopher Dimech, 2020/11/10
- Re: Cycle Org Shift Select, Michael Heerdegen, 2020/11/10
RE: Cycle Org Shift Select, Drew Adams, 2020/11/10
- RE: Cycle Org Shift Select,
Drew Adams <=
Re: Cycle Org Shift Select, Michael Heerdegen, 2020/11/09