From bbf5eb2805e13c8e93f512c678054654c0917100 Mon Sep 17 00:00:00 2001 From: "Richard M. Stallman" Date: Sat, 12 Apr 1997 03:18:33 +0000 Subject: [PATCH] Add defgroup's; use defcustom for user vars. --- lisp/bookmark.el | 67 +++++++++++++++++++++---------- lisp/dabbrev.el | 77 +++++++++++++++++++++++++----------- lisp/desktop.el | 53 +++++++++++++++++-------- lisp/jka-compr.el | 43 +++++++++++++++----- lisp/progmodes/executable.el | 46 +++++++++++++++------ lisp/textmodes/makeinfo.el | 17 ++++++-- lisp/textmodes/ooutline.el | 34 +++++++++++----- 7 files changed, 242 insertions(+), 95 deletions(-) diff --git a/lisp/bookmark.el b/lisp/bookmark.el index 2905447681c..ff42e8f24fe 100644 --- a/lisp/bookmark.el +++ b/lisp/bookmark.el @@ -1,6 +1,6 @@ ;;; bookmark.el --- set bookmarks, maybe annotate them, jump to them later. -;; Copyright (C) 1993, 1994, 1995, 1996 Free Software Foundation +;; Copyright (C) 1993, 1994, 1995, 1996, 1997 Free Software Foundation ;; Author: Karl Fogel ;; Maintainer: Karl Fogel @@ -99,12 +99,19 @@ maintainers to avoid version confusion.") ;;; User Variables -(defvar bookmark-use-annotations nil +(defgroup bookmark nil + "Setting, annotation and jumping to bookmarks" + :group 'matching) + + +(defcustom bookmark-use-annotations nil "*If non-nil, saving a bookmark will query for an annotation in a -buffer.") +buffer." + :type 'boolean + :group 'bookmark) -(defvar bookmark-save-flag t +(defcustom bookmark-save-flag t "*Controls when Emacs saves bookmarks to a file. --> Nil means never save bookmarks, except when `bookmark-save' is explicitly called \(\\[bookmark-save]\). @@ -120,7 +127,9 @@ bookmark is to set this variable to 1 \(or 0, which produces the same behavior.\) To specify the file in which to save them, modify the variable -bookmark-default-file, which is `~/.emacs.bmk' by default.") +bookmark-default-file, which is `~/.emacs.bmk' by default." + :type '(choice (const nil) (const t) integer) + :group 'bookmark) (defconst bookmark-old-default-file "~/.emacs-bkmrks" @@ -131,51 +140,67 @@ bookmark-default-file, which is `~/.emacs.bmk' by default.") (defvar bookmark-file nil "Old name for `bookmark-default-file'.") -(defvar bookmark-default-file +(defcustom bookmark-default-file (if bookmark-file ;; In case user set `bookmark-file' in her .emacs: bookmark-file (convert-standard-filename "~/.emacs.bmk")) - "*File in which to save bookmarks by default.") + "*File in which to save bookmarks by default." + :type 'file + :group 'bookmark) -(defvar bookmark-version-control 'nospecial +(defcustom bookmark-version-control 'nospecial "*Whether or not to make numbered backups of the bookmark file. It can have four values: t, nil, `never', and `nospecial'. The first three have the same meaning that they do for the variable `version-control', and the final value `nospecial' means just -use the value of `version-control'.") +use the value of `version-control'." + :type '(choice (const t) (const nil) (const never) (const nospecial)) + :group 'bookmark) -(defvar bookmark-completion-ignore-case t - "*Non-nil means bookmark functions ignore case in completion.") +(defcustom bookmark-completion-ignore-case t + "*Non-nil means bookmark functions ignore case in completion." + :type 'boolean + :group 'bookmark) -(defvar bookmark-sort-flag t +(defcustom bookmark-sort-flag t "*Non-nil means that bookmarks will be displayed sorted by bookmark name. Otherwise they will be displayed in LIFO order (that is, most -recently set ones come first, oldest ones come last).") +recently set ones come first, oldest ones come last)." + :type 'boolean + :group 'bookmark) -(defvar bookmark-automatically-show-annotations t - "*Nil means don't show annotations when jumping to a bookmark.") +(defcustom bookmark-automatically-show-annotations t + "*Nil means don't show annotations when jumping to a bookmark." + :type 'boolean + :group 'bookmark) -(defvar bookmark-bmenu-file-column 30 +(defcustom bookmark-bmenu-file-column 30 "*Column at which to display filenames in a buffer listing bookmarks. -You can toggle whether files are shown with \\\\[bookmark-bmenu-toggle-filenames].") +You can toggle whether files are shown with \\\\[bookmark-bmenu-toggle-filenames]." + :type 'integer + :group 'bookmark) -(defvar bookmark-bmenu-toggle-filenames t +(defcustom bookmark-bmenu-toggle-filenames t "*Non-nil means show filenames when listing bookmarks. This may result in truncated bookmark names. To disable this, put the following in your .emacs: -\(setq bookmark-bmenu-toggle-filenames nil\)") +\(setq bookmark-bmenu-toggle-filenames nil\)" + :type 'boolean + :group 'bookmark) -(defvar bookmark-menu-length 70 - "*Maximum length of a bookmark name displayed on a popup menu.") +(defcustom bookmark-menu-length 70 + "*Maximum length of a bookmark name displayed on a popup menu." + :type 'integer + :group 'boolean) ;;; No user-serviceable parts beyond this point. diff --git a/lisp/dabbrev.el b/lisp/dabbrev.el index 2c28b39c4d1..87f87e014d0 100644 --- a/lisp/dabbrev.el +++ b/lisp/dabbrev.el @@ -97,40 +97,60 @@ ;;---------------------------------------------------------------- ;; Customization variables ;;---------------------------------------------------------------- -(defvar dabbrev-backward-only nil - "*If non-nil, `dabbrev-expand' only looks backwards.") -(defvar dabbrev-limit nil - "*Limits region searched by `dabbrev-expand' to this many chars away.") +(defgroup dabbrev nil + "Dynamic Abbreviations" + :tag "Dynamic Abbreviations" + :group 'abbrev) -(defvar dabbrev-abbrev-skip-leading-regexp nil +(defcustom dabbrev-backward-only nil + "*If non-nil, `dabbrev-expand' only looks backwards." + :type 'boolean + :group 'dabbrev) + +(defcustom dabbrev-limit nil + "*Limits region searched by `dabbrev-expand' to this many chars away." + :type '(choice (const :tag "off" nil) + integer) + :group 'dabbrev) + +(defcustom dabbrev-abbrev-skip-leading-regexp nil "*Regexp for skipping leading characters of an abbreviation. Example: Set this to \"\\\\$\" for programming languages in which variable names may appear with or without a leading `$'. -\(For example, in Makefiles.) +\(For example, in Makefiles. + :type 'regexp + :group 'dabbrev)) -Set this to nil if no characters should be skipped.") +Set this to nil if no characters should be skipped." + :type '(choice regexp + (const :tag "off" nil)) + :group 'dabbrev) ;; I recommend that you set this to nil. -(defvar dabbrev-case-fold-search 'case-fold-search +(defcustom dabbrev-case-fold-search 'case-fold-search "*Non-nil if dabbrev searches should ignore case. A value of nil means case is significant. The value of this variable is an expression; it is evaluated and the resulting value determines the decision. For example: setting this to `case-fold-search' means evaluate that -variable to see whether its value is nil.") +variable to see whether its value is nil." + :type 'sexp + :group 'dabbrev) -(defvar dabbrev-upcase-means-case-search nil +(defcustom dabbrev-upcase-means-case-search nil "*The significance of an uppercase character in an abbreviation. nil means case fold search, non-nil means case sensitive search. This variable has an effect only when the value of -`dabbrev-case-fold-search' evaluates to t.") +`dabbrev-case-fold-search' evaluates to t." + :type 'boolean + :group 'dabbrev) ;; I recommend that you set this to nil. -(defvar dabbrev-case-replace 'case-replace +(defcustom dabbrev-case-replace 'case-replace "*Non-nil means dabbrev should preserve case when expanding the abbreviation. More precisely, it preserves the case pattern of the abbreviation as you typed it--as opposed to the case pattern of the expansion that is copied. @@ -140,9 +160,11 @@ For example, setting this to `case-replace' means evaluate that variable to see if its value is t or nil. This variable has an effect only when the value of -`dabbrev-case-fold-search' evaluates to t.") +`dabbrev-case-fold-search' evaluates to t." + :type 'sexp + :group 'dabbrev) -(defvar dabbrev-abbrev-char-regexp nil +(defcustom dabbrev-abbrev-char-regexp nil "*Regexp to recognize a character in an abbreviation or expansion. This regexp will be surrounded with \\\\( ... \\\\) when actually used. @@ -162,9 +184,12 @@ starting with or containing `no-'. If you set this variable to expanding `yes-or-no-' signals an error because `-' is not part of a word; but expanding `yes-or-no' looks for a word starting with `no'. -The recommended value is \"\\\\sw\\\\|\\\\s_\".") +The recommended value is \"\\\\sw\\\\|\\\\s_\"." + :type '(choice (const nil) + regexp) + :group 'dabbrev) -(defvar dabbrev-check-all-buffers t +(defcustom dabbrev-check-all-buffers t "*Non-nil means dabbrev package should search *all* buffers. Dabbrev always searches the current buffer first. Then, if @@ -172,9 +197,11 @@ Dabbrev always searches the current buffer first. Then, if designated by `dabbrev-select-buffers-function'. Then, if `dabbrev-check-all-buffers' is non-nil, dabbrev searches -all the other buffers.") +all the other buffers." + :type 'boolean + :group 'dabbrev) -(defvar dabbrev-check-other-buffers t +(defcustom dabbrev-check-other-buffers t "*Should \\[dabbrev-expand] look in other buffers?\ nil: Don't look in other buffers. @@ -184,7 +211,11 @@ Anything else: When we can't find any more expansions in the current buffer, then ask the user whether to look in other buffers too. -The default value is t.") +The default value is t." + :type '(choice (const :tag "off" nil) + (const :tag "on" t) + (const :tag "ask" other)) + :group 'dabbrev) ;; I guess setting this to a function that selects all C- or C++- ;; mode buffers would be a good choice for a debugging buffer, @@ -197,7 +228,7 @@ an example. A mode setting this variable should make it buffer local.") -(defvar dabbrev-friend-buffer-function 'dabbrev--same-major-mode-p +(defcustom dabbrev-friend-buffer-function 'dabbrev--same-major-mode-p "*A function to decide whether dabbrev should search OTHER-BUFFER. The function should take one argument, OTHER-BUFFER, and return non-nil if that buffer should be searched. Have a look at @@ -207,9 +238,11 @@ The value of `dabbrev-friend-buffer-function' has an effect only if the value of `dabbrev-select-buffers-function' uses it. The function `dabbrev--select-buffers' is one function you can use here. -A mode setting this variable should make it buffer local.") +A mode setting this variable should make it buffer local." + :type 'function + :group 'dabbrev) -(defvar dabbrev-search-these-buffers-only nil +(defcustom dabbrev-search-these-buffers-only nil "If non-nil, a list of buffers which dabbrev should search. If this variable is non-nil, dabbrev will only look in these buffers. It will not even look in the current buffer if it is not a member of diff --git a/lisp/desktop.el b/lisp/desktop.el index 4db51be00ba..56ac600dbc4 100644 --- a/lisp/desktop.el +++ b/lisp/desktop.el @@ -104,13 +104,20 @@ ;; ---------------------------------------------------------------------------- ;; USER OPTIONS -- settings you might want to play with. ;; ---------------------------------------------------------------------------- + +(defgroup desktop nil + "Save status of Emacs when you exit." + :group 'frames) + (defconst desktop-basefilename (convert-standard-filename ".emacs.desktop") "File for Emacs desktop, not including the directory name.") -(defvar desktop-missing-file-warning nil +(defcustom desktop-missing-file-warning nil "*If non-nil then desktop warns when a file no longer exists. -Otherwise it simply ignores that file.") +Otherwise it simply ignores that file." + :type 'boolean + :group 'desktop) (defvar desktop-globals-to-save (list 'desktop-missing-file-warning @@ -146,29 +153,39 @@ The variables are saved only when they really are local.") ;; We skip .log files because they are normally temporary. ;; (ftp) files because they require passwords and whatnot. ;; TAGS files to save time (tags-file-name is saved instead). -(defvar desktop-buffers-not-to-save +(defcustom desktop-buffers-not-to-save "\\(^nn\\.a[0-9]+\\|\\.log\\|(ftp)\\|^tags\\|^TAGS\\)$" - "Regexp identifying buffers that are to be excluded from saving.") + "Regexp identifying buffers that are to be excluded from saving." + :type 'regexp + :group 'desktop) ;; Skip ange-ftp files -(defvar desktop-files-not-to-save +(defcustom desktop-files-not-to-save "^/[^/:]*:" - "Regexp identifying files whose buffers are to be excluded from saving.") + "Regexp identifying files whose buffers are to be excluded from saving." + :type 'regexp + :group 'desktop) -(defvar desktop-buffer-major-mode nil - "When desktop creates a buffer, this holds the desired Major mode.") +(defcustom desktop-buffer-major-mode nil + "When desktop creates a buffer, this holds the desired Major mode." + :type 'symbol + :group 'desktop) -(defvar desktop-buffer-file-name nil - "When desktop creates a buffer, this holds the file name to visit.") +(defcustom desktop-buffer-file-name nil + "When desktop creates a buffer, this holds the file name to visit." + :type '(choice file (const nil)) + :group 'desktop) -(defvar desktop-buffer-name nil - "When desktop creates a buffer, this holds the desired buffer name.") +(defcustom desktop-buffer-name nil + "When desktop creates a buffer, this holds the desired buffer name." + :type '(choice string (const nil)) + :group 'desktop) (defvar desktop-buffer-misc nil "When desktop creates a buffer, this holds a list of misc info. It is used by the `desktop-buffer-handlers' functions.") -(defvar desktop-buffer-handlers +(defcustom desktop-buffer-handlers '(desktop-buffer-dired desktop-buffer-rmail desktop-buffer-mh @@ -179,14 +196,18 @@ The functions are called without explicit parameters but can use the variables `desktop-buffer-major-mode', `desktop-buffer-file-name', `desktop-buffer-name'. If one function returns non-nil, no further functions are called. -If the function returns t then the buffer is considered created.") +If the function returns t then the buffer is considered created." + :type '(repeat function) + :group 'desktop) (defvar desktop-create-buffer-form "(desktop-create-buffer 205" "Opening of form for creation of new buffers.") -(defvar desktop-save-hook nil +(defcustom desktop-save-hook nil "Hook run before saving the desktop to allow you to cut history lists and -the like shorter.") +the like shorter." + :type 'hook + :group 'desktop) ;; ---------------------------------------------------------------------------- (defvar desktop-dirname nil "The directory in which the current desktop file resides.") diff --git a/lisp/jka-compr.el b/lisp/jka-compr.el index cc0a03a5491..ff176345a86 100644 --- a/lisp/jka-compr.el +++ b/lisp/jka-compr.el @@ -1,6 +1,6 @@ ;;; jka-compr.el --- reading/writing/loading compressed files -;; Copyright (C) 1993, 1994 Free Software Foundation, Inc. +;; Copyright (C) 1993, 1994, 1995, 1997 Free Software Foundation, Inc. ;; Author: jka@ece.cmu.edu (Jay K. Adams) ;; Keywords: data @@ -99,19 +99,29 @@ ;;; Code: -(defvar jka-compr-shell "sh" +(defgroup compression nil + "Data compression utilities" + :group 'data) + +(defgroup jka-compr nil + "jka-compr customization" + :group 'compression) + + +(defcustom jka-compr-shell "sh" "*Shell to be used for calling compression programs. The value of this variable only matters if you want to discard the stderr of a compression/decompression program (see the documentation -for `jka-compr-compression-info-list').") - +for `jka-compr-compression-info-list')." + :type 'string + :group 'jka-compr) (defvar jka-compr-use-shell t) ;;; I have this defined so that .Z files are assumed to be in unix ;;; compress format; and .gz files, in gzip format. -(defvar jka-compr-compression-info-list +(defcustom jka-compr-compression-info-list ;;[regexp ;; compr-message compr-prog compr-args ;; uncomp-message uncomp-prog uncomp-args @@ -160,7 +170,21 @@ APPEND-FLAG EXTENSION], where: Because of the way `call-process' is defined, discarding the stderr output of a program adds the overhead of starting a shell each time the program is -invoked.") +invoked." + :type '(repeat (vector regexp + (choice :tag "Compress Message" + (string :format "%v") + (const :tag "No Message" nil)) + (string :tag "Compress Program") + (repeat :tag "Compress Arguments" string) + (choice :tag "Uncompress Message" + (string :format "%v") + (const :tag "No Message" nil)) + (string :tag "Uncompress Program") + (repeat :tag "Uncompress Arguments" string) + (boolean :tag "Append") + (boolean :tag "Auto Mode"))) + :group 'jka-compr) (defvar jka-compr-mode-alist-additions (list (cons "\\.tgz\\'" 'tar-mode)) @@ -312,11 +336,12 @@ to keep: LEN chars starting BEG chars from the beginning." ;;; Support for temp files. Much of this was inspired if not lifted ;;; from ange-ftp. -(defvar jka-compr-temp-name-template +(defcustom jka-compr-temp-name-template (expand-file-name "jka-com" (or (getenv "TMPDIR") "/tmp/")) - "Prefix added to all temp files created by jka-compr. -There should be no more than seven characters after the final `/'") +There should be no more than seven characters after the final `/'." + :type 'string + :group 'jka-compr) (defvar jka-compr-temp-name-table (make-vector 31 nil)) diff --git a/lisp/progmodes/executable.el b/lisp/progmodes/executable.el index 62d6f59fbbb..42d16cbdb5e 100644 --- a/lisp/progmodes/executable.el +++ b/lisp/progmodes/executable.el @@ -52,39 +52,59 @@ ;;; Code: -(defvar executable-insert t +(defgroup executable nil + "Base functionality for executable interpreter scripts" + :group 'processes) + +(defcustom executable-insert 'other "*Non-nil means offer to add a magic number to a file. This takes effect when you switch to certain major modes, including Shell-script mode (`sh-mode'). When you type \\[executable-set-magic], it always offers to add or -update the magic number.") +update the magic number." + :type '(choice (const :tag "off" nil) + (const :tag "on" t) + symbol) + :group 'executable) -(defvar executable-query 'function - "*If non-nil, ask user before changing an existing magic number. -When this is `function', only ask when called non-interactively.") +(defcustom executable-query 'function + "*If non-nil, ask user before changing an existing magic number. +When this is `function', only ask when called non-interactively." + :type '(choice (const :tag "Don't Ask" nil) + (const :tag "Ask" t) + (const :tag "Ask when non-interactive" function)) + :group 'executable) -(defvar executable-magicless-file-regexp "/[Mm]akefile$\\|/\\.\\(z?profile\\|bash_profile\\|z?login\\|bash_login\\|z?logout\\|bash_logout\\|.+shrc\\|esrc\\|rcrc\\|[kz]shenv\\)$" - "*On files with this kind of name no magic is inserted or changed.") +(defcustom executable-magicless-file-regexp "/[Mm]akefile$\\|/\\.\\(z?profile\\|bash_profile\\|z?login\\|bash_login\\|z?logout\\|bash_logout\\|.+shrc\\|esrc\\|rcrc\\|[kz]shenv\\)$" + "*On files with this kind of name no magic is inserted or changed." + :type 'regexp + :group 'executable) -(defvar executable-prefix "#! " - "*Interpreter magic number prefix inserted when there was no magic number.") +(defcustom executable-prefix "#! " + "*Interpreter magic number prefix inserted when there was no magic number." + :type 'string + :group 'executable) -(defvar executable-chmod 73 +(defcustom executable-chmod 73 "*After saving, if the file is not executable, set this mode. This mode passed to `set-file-modes' is taken absolutely when negative, or relative to the files existing modes. Do nothing if this is nil. -Typical values are 73 (+x) or -493 (rwxr-xr-x).") +Typical values are 73 (+x) or -493 (rwxr-xr-x)." + :type 'integer + :group 'executable) (defvar executable-command nil) -(defvar executable-self-display "tail" +(defcustom executable-self-display "tail" "*Command you use with argument `+2' to make text files self-display. -Note that the like of `more' doesn't work too well under Emacs \\[shell].") +Note that the like of `more' doesn't work too well under Emacs \\[shell]." + :type 'string + :group 'executable) (defvar executable-font-lock-keywords diff --git a/lisp/textmodes/makeinfo.el b/lisp/textmodes/makeinfo.el index a649d522156..d6ee7bbb1c0 100644 --- a/lisp/textmodes/makeinfo.el +++ b/lisp/textmodes/makeinfo.el @@ -47,15 +47,24 @@ (require 'compile) -(defvar makeinfo-run-command "makeinfo" +(defgroup makeinfo nil + "Run makeinfo conveniently" + :group 'docs) + + +(defcustom makeinfo-run-command "makeinfo" "*Command used to run `makeinfo' subjob. -The name of the file is appended to this string, separated by a space.") +The name of the file is appended to this string, separated by a space." + :type 'string + :group 'makeinfo) -(defvar makeinfo-options "--fill-column=70" +(defcustom makeinfo-options "--fill-column=70" "*String containing options for running `makeinfo'. Do not include `--footnote-style' or `--paragraph-indent'; the proper way to specify those is with the Texinfo commands -`@footnotestyle` and `@paragraphindent'.") +`@footnotestyle` and `@paragraphindent'." + :type 'string + :group 'makeinfo) (require 'texinfo) diff --git a/lisp/textmodes/ooutline.el b/lisp/textmodes/ooutline.el index af053cc3245..558d0a1cffc 100644 --- a/lisp/textmodes/ooutline.el +++ b/lisp/textmodes/ooutline.el @@ -1,6 +1,6 @@ ;;; outline.el --- outline mode commands for Emacs -;; Copyright (C) 1986, 1993, 1994 Free Software Foundation, Inc. +;; Copyright (C) 1986, 1993, 1994, 1997 Free Software Foundation, Inc. ;; Maintainer: FSF ;; Keywords: outlines @@ -31,24 +31,34 @@ ;;; Code: ;; Jan '86, Some new features added by Peter Desnoyers and rewritten by RMS. - -(defvar outline-regexp nil + +(defgroup outlines nil + "Support for hierarchical outlining" + :prefix "outline-" + :group 'editing) + + +(defcustom outline-regexp nil "*Regular expression to match the beginning of a heading. Any line whose beginning matches this regexp is considered to start a heading. The recommended way to set this is with a Local Variables: list -in the file it applies to. See also outline-heading-end-regexp.") +in the file it applies to. See also outline-heading-end-regexp." + :type '(choice regexp (const nil)) + :group 'outlines) ;; Can't initialize this in the defvar above -- some major modes have ;; already assigned a local value to it. (or (default-value 'outline-regexp) (setq-default outline-regexp "[*\^L]+")) -(defvar outline-heading-end-regexp "[\n\^M]" +(defcustom outline-heading-end-regexp "[\n\^M]" "*Regular expression to match the end of a heading line. You can assume that point is at the beginning of a heading when this regexp is searched for. The heading ends at the end of the match. The recommended way to set this is with a \"Local Variables:\" list -in the file it applies to.") +in the file it applies to." + :type 'regexp + :group 'outlines) (defvar outline-mode-prefix-map nil) @@ -129,8 +139,10 @@ in the file it applies to.") (define-key outline-mode-map "\C-c" outline-mode-prefix-map) (define-key outline-mode-map [menu-bar] outline-mode-menu-bar-map)) -(defvar outline-minor-mode nil - "Non-nil if using Outline mode as a minor mode of some other mode.") +(defcustom outline-minor-mode nil + "Non-nil if using Outline mode as a minor mode of some other mode." + :type 'boolean + :group 'outlines) (make-variable-buffer-local 'outline-minor-mode) (put 'outline-minor-mode 'permanent-local t) (or (assq 'outline-minor-mode minor-mode-alist) @@ -215,10 +227,12 @@ Turning on outline mode calls the value of `text-mode-hook' and then of (add-hook 'change-major-mode-hook 'show-all) (run-hooks 'text-mode-hook 'outline-mode-hook)) -(defvar outline-minor-mode-prefix "\C-c@" +(defcustom outline-minor-mode-prefix "\C-c@" "*Prefix key to use for Outline commands in Outline minor mode. The value of this variable is checked as part of loading Outline mode. -After that, changing the prefix key requires manipulating keymaps.") +After that, changing the prefix key requires manipulating keymaps." + :type 'string + :group 'outlines) (defvar outline-minor-mode-map nil) (if outline-minor-mode-map -- 2.39.2