unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: "Óscar Fuentes" <ofv@wanadoo.es>
To: emacs-devel@gnu.org
Subject: Wierd Elispsisms (was: trunk r113793: lisp/*.el: More lexical-binding warnings' cleanups.)
Date: Sun, 11 Aug 2013 13:16:40 +0200	[thread overview]
Message-ID: <87iozcmq93.fsf@wanadoo.es> (raw)
In-Reply-To: E1V8JCW-0006AY-BZ@vcs.savannah.gnu.org

Juanma Barranquero <lekktu@gmail.com> writes:

[elisp/woman.el]

@@ -1614,7 +1614,7 @@
 	(let* ((bufname (file-name-nondirectory file-name))
 	       (case-fold-search t)
 	       (compressed
-		(not (not (string-match woman-file-compression-regexp bufname)))))
+		(and (string-match-p woman-file-compression-regexp bufname) t)))
 	  (if compressed
 	      (setq bufname (file-name-sans-extension bufname)))



The expressions

(not (not (something)))

and

(and (something-p) t)

look bizarre. As someone who is not strong on Elisp, I was puzzled at
first. Finally realized that the point is to force a boolean value for
`compressed'.

Why is so important to use a nil/t value for `compressed'?

And, if there exists a reason for using nil/t instead of the original
value here and elsewhere, why doesn't exist a function for casting an
arbitrary value to a boolean?

Using (and ... t) or (not (not ...)) is probably not harder to type than
a function, but the function has the advantage of clearly conveying the
intention and is safer to edit.




       reply	other threads:[~2013-08-11 11:16 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <E1V8JCW-0006AY-BZ@vcs.savannah.gnu.org>
2013-08-11 11:16 ` Óscar Fuentes [this message]
2013-08-11 11:41   ` Wierd Elispsisms (was: trunk r113793: lisp/*.el: More lexical-binding warnings' cleanups.) Juanma Barranquero
2013-08-11 22:33     ` Wierd Elispsisms Óscar Fuentes
2013-08-11 18:28 ` trunk r113793: lisp/*.el: More lexical-binding warnings' cleanups Glenn Morris
2013-08-12 15:12   ` Juanma Barranquero

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

  List information: https://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to=87iozcmq93.fsf@wanadoo.es \
    --to=ofv@wanadoo.es \
    --cc=emacs-devel@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 public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).