all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: pjb@informatimago.com (Pascal J. Bourguignon)
To: help-gnu-emacs@gnu.org
Subject: Re: How to see that a variable holds t
Date: Mon, 04 Jan 2010 17:44:16 +0100	[thread overview]
Message-ID: <877hrxyg4f.fsf@hubble.informatimago.com> (raw)
In-Reply-To: 87bphacj64.fsf@Traian.DecebalComp

Cecil Westerhof <Cecil@decebal.nl> writes:

> pjb@informatimago.com (Pascal J. Bourguignon) writes:
>
>>> What I really would like is;
>>>     (defun switch-gnus-idle-daemon-do-log ()
>>>       (interactive)
>>>       (setq gnus-idle-daemon-do-log
>>>             (case gnus-idle-daemon-do-log
>>>               (t         10)
>>>               (otherwise t)))
>>>       (message "gnus-idle-daemon-do-log: %s" gnus-idle-daemon-do-log))
>>>
>>> Because I would like the default to be t and not 10. (For when the value
>>> is not one of the defined values.) But when I do this, it is always set
>>> to 10, because the case does not make a difference between t and 10. How
>>> do I solve this?
>>
>> The first clause is always selected because in emacs lisp, t and
>> otherwise are equivalent in case.
>>
>> I don't understand you people!  How fucking difficult is it to type
>> C-h f case RET and READ the documentation?
>
> I had looked up case, but not in Emacs itself. In the definition I found
> it was not mentioned that t is the same as otherwise.

Yes, you have to be careful.  In general operators that are common to
emacs lisp and Common Lisp are rather similar, but there are sometimes
some significant differences, and sometimes more subtle differences.
Always check with the doc.  You could even bind space to automatically
find the doc for you:

(defun space-doc ()
  (interactive)
  (save-excursion
    (backward-sexp) (backward-char)
    (when (looking-at "(")
      (forward-char)
      (when (thing-at-point 'symbol)
        (let* ((start (point))
               (end (progn (forward-sexp) (point)))
               (symname (buffer-substring start end)))
          (ignore-errors (describe-function (intern symname)))))))
  (insert " "))

(global-set-key (kbd "SPC") 'space-doc)
;; Or use local-set-key in mode hooks where you write emacs lisp code
;; such as emacs-lisp-mode-hook.


-- 
__Pascal Bourguignon__                     http://www.informatimago.com/


  reply	other threads:[~2010-01-04 16:44 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-01-03 17:11 How to see that a variable holds t Cecil Westerhof
2010-01-03 19:25 ` Andreas Politz
2010-01-03 20:32 ` Lennart Borgman
2010-01-03 21:46 ` Tim X
     [not found] ` <87wrzysjty.fsf@hubble.informatimago.com>
2010-01-04  9:29   ` Cecil Westerhof
2010-01-04 16:44     ` Pascal J. Bourguignon [this message]
2010-01-04 17:11       ` Cecil Westerhof
2010-01-06 13:29   ` Cecil Westerhof
2010-01-06 18:12     ` Stefan Monnier
2010-01-06 18:30       ` Cecil Westerhof
2010-01-06 20:09         ` Pascal J. Bourguignon
2010-01-06 18:51     ` Pascal J. Bourguignon
2010-01-06 19:13       ` Cecil Westerhof

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=877hrxyg4f.fsf@hubble.informatimago.com \
    --to=pjb@informatimago.com \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.