help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: setting email and name for Changelogs in vc mode


From: Thien-Thi Nguyen
Subject: Re: setting email and name for Changelogs in vc mode
Date: Sun, 26 Feb 2006 01:10:31 +0100
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux)

Angelina Carlton <brat@magma.ca> writes:

> I can't find this in my customize menu's, does someone know
> the correct way?

here is a fragment from the bindings block of a `let' form in
the function `vc-default-update-changelog' (which eventually
is called when you do `C-x v a'):

    (login-name (or user-login-name
                    (format "uid%d" (number-to-string (user-uid)))))

    (full-name (or add-log-full-name
                   (user-full-name)
                   (user-login-name)
                   (format "uid%d"
                           (number-to-string (user-uid)))))

    (mailing-address (or add-log-mailing-address
                         user-mail-address))

for leggibility, i have added a blank line between each of the
three forms.  the car of each form is the name of a temporary
variable that is used elsewhere in the function.  we cannot
set those values directly, only indirectly by munging the
values of variables referenced in the `(or ...)' part of each
binding.

the value of `(or A B C)' depends on which of A, B or C (in
that order) first evaluates to a non-nil value.  evaluation is
done arg by arg; it is a search.

all this means is that we can influence the temporary
variables in several ways in the `(or ...)' form, depending on
where in the search we want the answer to be found.  in a
nutshell: a "naked" symbol is a variable reference -- you can
setq that variable directly.  a symbol surrounded by parens is
evaluated by calling a function by that name w/ no args.

w/ these two guidelines, we can, for example, influence the
`full-name' temporary variable by any of:

  (setq add-log-full-name "J.R.Hacker")
  (defun user-full-name () "J.R.Hacker")
  (defun user-login-name () "J.R.Hacker")
  (defun user-id () 42) ;; assuming J.R.Hacker has uid 42

likewise w/ the other temporary variables.  the thing to
remember is that `or' stops when it finds a form that
evaluates to non-nil.  so if you defun both `user-full-name'
and `user-login-name', the former takes precedence.  (so what
happens if `user-full-name' returns nil? <-- bonus question)

anyway, these are my thoughts browsing the source.

thi


reply via email to

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