help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: Possible to conditionally bind variable?


From: Nicolas Richard
Subject: Re: Possible to conditionally bind variable?
Date: Thu, 11 Sep 2014 14:24:34 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.93 (gnu/linux)

address@hidden (Tory S. Anderson) writes:
> (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-other-buffer)
>                               '(switch-to-buffer)))
>     (if (get-buffer buffer)
>       (my-switch-function buffer)
>       (my-switch-function some-other-buffer))))) 

untested :

(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))))

HTH,

-- 
Nicolas Richard



reply via email to

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