|
From: | Stefan Monnier |
Subject: | Re: Possible to conditionally bind variable? |
Date: | Thu, 11 Sep 2014 08:34:33 -0400 |
User-agent: | Gnus/5.13 (Gnus v5.13) Emacs/24.4.50 (gnu/linux) |
> (defun go-or-make-agenda (&optional new-frame) > (interactive "P") > (let ((buffer "\*Org Agenda\*") > (some-other-buffer "*scratch*") > (my-switch-function (if new-frame ;; is there some way to do this? > 'switch-to-buffer-other-frame > 'switch-to-buffer))) > (if (get-buffer buffer) > (funcall my-switch-function buffer) > (funcall my-switch-function some-other-buffer)))) Aka (defun go-or-make-agenda (&optional new-frame) (interactive "P") (let ((buffer "\*Org Agenda\*") (some-other-buffer "*scratch*") (my-switch-function (if new-frame ;; is there some way to do this? 'switch-to-buffer-other-frame 'switch-to-buffer))) (funcall my-switch-function (if (get-buffer buffer) buffer some-other-buffer)))) Aka (defun go-or-make-agenda (&optional new-frame) (interactive "P") (let ((buffer "\*Org Agenda\*") (some-other-buffer "*scratch*")) (funcall (if new-frame 'switch-to-buffer-other-frame 'switch-to-buffer) (if (get-buffer buffer) buffer some-other-buffer)))) -- Stefan
[Prev in Thread] | Current Thread | [Next in Thread] |