emacs-devel
[Top][All Lists]
Advanced

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

Re: keep|flush-lines, how-many to be used backward.


From: Robert J. Chassell
Subject: Re: keep|flush-lines, how-many to be used backward.
Date: Fri, 28 Sep 2007 22:25:35 +0000 (UTC)

    What I fail to agree with, is that a prefix argument can be a
    three-state boolean=A0: present, negative or positive.  

It is straight forward to provide three options or two depending on
whether the code distinguishes between a list and an integer.

(You can also distinguish between the integer -1 and the symbol `-',
but I never have.)

See: 

    (info "(elisp)Prefix Command Arguments")

which says,

   Here are the possible values of a raw prefix argument:

   * `nil', meaning there is no prefix argument.  Its numeric value is
     1, but numerous commands make a distinction between `nil' and the
     integer 1.

   * An integer, which stands for itself.

   * A list of one element, which is an integer.  This form of prefix
     argument results from one or a succession of `C-u''s with no
     digits.  The numeric value is the integer in the list, but some
     commands make a distinction between such a list and an integer
     alone.

   * The symbol `-'.  This indicates that `M--' or `C-u -' was typed,
     without following digits.  The equivalent numeric value is -1, but
     some commands make a distinction between the integer -1 and the
     symbol `-'.

That Info shows the results of interactively invoking a defun called
`display-prefix' in nine different ways.  (The whole defun is shown,
so you can copy it.)

With a slightly different definition for display-prefix than provided
by the manual, 

    (defun display-prefix (arg)
      "Display the value of the raw prefix arg."
      (interactive "P")
      (if (listp arg)
          (message "%s: is a list" arg)
        (message "%s: is not a list" arg)))

we find:

  list present

             M-x display-prefix  -| nil: is a list

     C-u     M-x display-prefix  -| (4): is a list

     C-u C-u M-x display-prefix  -| (16): is a list

  no list; number positive.  

     C-u 4   M-x display-prefix  -| 4: is not a list

     M-4     M-x display-prefix  -| 4: is not a list   ; (Same as `C-u 4'.)

  no list; number negative or non-existant

     C-u -   M-x display-prefix  -| -: is not a list

     M--     M-x display-prefix  -| -: is not a list   ; (Same as `C-u -'.)

     C-u - 7 M-x display-prefix  -| -7: is not a list

     M-- 7   M-x display-prefix  -| -7: is not a list  ; (Same as `C-u -7'.)

-- 
    Robert J. Chassell                          GnuPG Key ID: 004B4AC8
    address@hidden                         address@hidden
    http://www.rattlesnake.com                  http://www.teak.cc




reply via email to

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