auctex
[Top][All Lists]
Advanced

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

Mutability (was: Failed to skip from chapter tex file to master pdf file


From: Basil L. Contovounesios
Subject: Mutability (was: Failed to skip from chapter tex file to master pdf file.)
Date: Tue, 13 Jul 2021 12:31:20 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

Hongyi Zhao <hongyi.zhao@gmail.com> writes:

> On Mon, Jul 12, 2021 at 3:46 PM Tassilo Horn <tsdh@gnu.org> wrote:
>>
>> Hongyi Zhao <hongyi.zhao@gmail.com> writes:
>> >> (delq nil (mapcar (lambda (buf)
>> >>                     (with-current-buffer buf
>> >>                       (when (eq major-mode 'LaTeX-mode)
>> >>                         (cons (buffer-file-name buf)
>> >>                               (TeX-master-file "pdf")))))
>> >>                   (buffer-list)))
>> >> nil
>> >
>> > This is just out of the curiosity about the behavior of the `delq'
>> > built-in function used above. According to the built-in document:
>>
>> (delq nil '(nil 1 nil)) ;=> (1)
>> (delq nil '(nil nil nil)) ;=> nil, aka, the empty list ()
>> (eq nil '()) ;=> t
>
> Got it. The `nil' shown in my example just means the empty result list
> (). The `nil' in itself can be used in different context, when it's
> used as boolean variable, it means false. But it can also be used to
> represent an empty list ().

Yes, see also (info "(elisp) nil and t"):

https://www.gnu.org/software/emacs/manual//html_node/elisp/nil-and-t.html

Just be careful not to follow Tassilo's correct example too literally in
real code, as passing a quoted list literal such as '(1 2 3) to delq can
lead to unexpected side-effects.  In practice you should use delq only
when you know for certain that the list is safe to modify, and otherwise
use remq instead.  See (info "(elisp) Self-Evaluating Forms") and
(info "(elisp) Mutability"):

https://www.gnu.org/software/emacs/manual/html_node/elisp/Self_002dEvaluating-Forms.html
https://www.gnu.org/software/emacs/manual/html_node/elisp/Mutability.html

HTH,

-- 
Basil



reply via email to

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