emacs-devel
[Top][All Lists]
Advanced

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

Wierd Elispsisms (was: trunk r113793: lisp/*.el: More lexical-binding wa


From: Óscar Fuentes
Subject: Wierd Elispsisms (was: trunk r113793: lisp/*.el: More lexical-binding warnings' cleanups.)
Date: Sun, 11 Aug 2013 13:16:40 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux)

Juanma Barranquero <address@hidden> 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 via email to

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