emacs-devel
[Top][All Lists]
Advanced

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

customize-apropos


From: Luc Teirlinck
Subject: customize-apropos
Date: Fri, 9 Dec 2005 21:47:53 -0600 (CST)

I believe that there are two things wrong with `customize-apropos'.
Do `M-x customize-apropos RET buffer-menu'.

Note that the buffer contains:

    Buffer-menu-sort-column: Hide Value nil
       State: NO CUSTOMIZATION DATA; you should not see this.

    2 for sorting by buffer names.  5 for sorting by file names. More

I believe that this should not happen.  Variables should not be
included in the customize-apropos output just because their docstring
starts with a `*'.  If a variable should appear in a customization
buffer, one should define it with defcustom.  I believe that this
"feature" is just a remnant from the early days of Custom when barely
any variable had a defcustom.  I do not believe that the whole buffer
"Reset to Current" or "Reset to Saved" whole buffer buttons can handle
this type of options.  (The "Erase Customization" whole buffer button
can handle them: it ignores them, as it should.)

As a side remark, I believe that Buffer-menu-sort-column should either
be defined with defcustom, or (more likely) its docstring should not
start with a `*'.  (Is this variable not purely internal?)

A second problem with customize-apropos is that it can list several
aliases for the same option separately.  That can lead to quite some
confusion, especially if somebody would ever try to use any of these
dubious whole buffer buttons in such a buffer.

The patch below fixes these two problems.  If people absolutely want
to list non-defcustomed variables in the Custom buffer, they still can
after my patch, by giving customize-apropos a numeric argument.

===File ~/cus-edit-diff=====================================
*** cus-edit.el 08 Dec 2005 15:14:58 -0600      1.245
--- cus-edit.el 09 Dec 2005 20:23:10 -0600      
***************
*** 1252,1263 ****
  
  ;;;###autoload
  (defun customize-apropos (regexp &optional all)
!   "Customize all user options matching REGEXP.
  If ALL is `options', include only options.
  If ALL is `faces', include only faces.
  If ALL is `groups', include only groups.
! If ALL is t (interactively, with prefix arg), include options which are not
! user-settable, as well as faces and groups."
    (interactive "sCustomize regexp: \nP")
    (let ((found nil))
      (mapatoms (lambda (symbol)
--- 1252,1263 ----
  
  ;;;###autoload
  (defun customize-apropos (regexp &optional all)
!   "Customize all options, faces and groups matching REGEXP.
  If ALL is `options', include only options.
  If ALL is `faces', include only faces.
  If ALL is `groups', include only groups.
! If ALL is t (interactively, with prefix arg), include variables
! that are not customizable options, as well as faces and groups."
    (interactive "sCustomize regexp: \nP")
    (let ((found nil))
      (mapatoms (lambda (symbol)
***************
*** 1270,1280 ****
                    (push (list symbol 'custom-face) found))
                  (when (and (not (memq all '(groups faces)))
                             (boundp symbol)
                             (or (get symbol 'saved-value)
                                 (custom-variable-p symbol)
!                                (if (memq all '(nil options))
!                                    (user-variable-p symbol)
!                                  (get symbol 'variable-documentation))))
                    (push (list symbol 'custom-variable) found)))))
      (if (not found)
        (error "No matches")
--- 1270,1280 ----
                    (push (list symbol 'custom-face) found))
                  (when (and (not (memq all '(groups faces)))
                             (boundp symbol)
+                            (eq (indirect-variable symbol) symbol)
                             (or (get symbol 'saved-value)
                                 (custom-variable-p symbol)
!                                (and (not (memq all '(nil options)))
!                                     (get symbol 'variable-documentation))))
                    (push (list symbol 'custom-variable) found)))))
      (if (not found)
        (error "No matches")
***************
*** 1284,1291 ****
  
  ;;;###autoload
  (defun customize-apropos-options (regexp &optional arg)
!   "Customize all user options matching REGEXP.
! With prefix arg, include options which are not user-settable."
    (interactive "sCustomize regexp: \nP")
    (customize-apropos regexp (or arg 'options)))
  
--- 1284,1291 ----
  
  ;;;###autoload
  (defun customize-apropos-options (regexp &optional arg)
!   "Customize all customizable options matching REGEXP.
! With prefix arg, include variables that are not customizable options."
    (interactive "sCustomize regexp: \nP")
    (customize-apropos regexp (or arg 'options)))
  
============================================================




reply via email to

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