Questions tagged [boolean]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
24 votes
3 answers

How to choose between nil and 0, or t and 1 when setting variables or enabling modes

I understand that nil, 0 and/or -1 are used for disabling some features and t, 1 and/or +1 are used for enabling some features. When assigning variables or enabling/disabling minor modes, which ...
  • 343
10 votes
3 answers

What Emacs Lisp boolean/logical convenience functions exist?

What boolean/logical convenience functions / macros are available for Emacs Lisp in either the core set of functions or external packages? I'm interested in just about anything other than the built-in ...
  • 7,004
9 votes
3 answers

Quick way to toggle a variable

It would be nice to have a quick way to toggle a variable. Here's something that I have in mind. Call a "toggle var" function. The completing-read should list only variables that have single values (...
  • 24.6k
8 votes
2 answers

Understanding elisp idiom(boolean values vs. quoted arguments)?

I have some basic questions about elisp. I often see something like (search-forward "something" nil 'noerror) And sometimes I see something like (search-forward "something" nil :noerror) What is ...
  • 3,311
4 votes
2 answers

How do I splat the arguments to the `or` function?

I would like to evaluate a list of booleans like (nil nil t) into a single boolean, such that if any element is true, then the expression evaluates to true. I first looked at the (or) function in ...
0 votes
1 answer

why does this function return integers instead of `t` or `nil`

Why does this function print non-zero integers on non-empty lines? ;; taken from (defun current-line-empty-p () (interactive) (setq answer (string-...
0 votes
2 answers

Checking optional function argument

If I have an optional function argument, how can I determine if name has been supplied. And if it has been supplied, how can I test its validity (not nil or not empty string). (defun myfunc (&...
  • 385