[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Possible to conditionally bind variable?
From: |
Tory S. Anderson |
Subject: |
Re: Possible to conditionally bind variable? |
Date: |
Thu, 11 Sep 2014 08:43:20 -0400 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) |
Wow! It works!
So, I forgot the funcall my first time and it didn't work; it said "Symbol's
function definition is void: my-switch-function". How do the funcalls fix it? I
thought the first item in parens was automatically called as a function unless
quoted?
Lisp FTW
Nicolas Richard <theonewiththeevillook@yahoo.fr> writes:
> torys.anderson@gmail.com (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,