Mercurial > emacs
annotate lisp/obsolete/options.el @ 94357:5f0e2d26daed
(fortran-mode-syntax-table): Change `;' to punctuation now it's not
needed for abbrevs.
(fortran-mode-abbrev-table): Remove defvar, make use of new
define-abbrev-table :regexp feature.
author | Glenn Morris <rgm@gnu.org> |
---|---|
date | Sat, 26 Apr 2008 02:33:47 +0000 |
parents | ee22366f2a68 |
children | 43d30a1ea764 |
rev | line source |
---|---|
51342 | 1 ;;; options.el --- edit Options command for Emacs |
2 | |
74509 | 3 ;; Copyright (C) 1985, 2001, 2002, 2003, 2004, 2005, |
79715 | 4 ;; 2006, 2007, 2008 Free Software Foundation, Inc. |
51342 | 5 |
6 ;; Maintainer: FSF | |
7 | |
8 ;; This file is part of GNU Emacs. | |
9 | |
10 ;; GNU Emacs is free software; you can redistribute it and/or modify | |
11 ;; it under the terms of the GNU General Public License as published by | |
78228
1e016d63f292
Switch license to GPLv3 or later.
Glenn Morris <rgm@gnu.org>
parents:
75347
diff
changeset
|
12 ;; the Free Software Foundation; either version 3, or (at your option) |
51342 | 13 ;; any later version. |
14 | |
15 ;; GNU Emacs is distributed in the hope that it will be useful, | |
16 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | |
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
18 ;; GNU General Public License for more details. | |
19 | |
20 ;; You should have received a copy of the GNU General Public License | |
21 ;; along with GNU Emacs; see the file COPYING. If not, write to the | |
64085 | 22 ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
23 ;; Boston, MA 02110-1301, USA. | |
51342 | 24 |
25 ;;; Commentary: | |
26 | |
94000
ee22366f2a68
Add a comment giving version of obsolescence.
Glenn Morris <rgm@gnu.org>
parents:
93975
diff
changeset
|
27 ;; This file has been obsolete since Emacs 22.1. |
ee22366f2a68
Add a comment giving version of obsolescence.
Glenn Morris <rgm@gnu.org>
parents:
93975
diff
changeset
|
28 |
51342 | 29 ;; This code provides functions to list and edit the values of all global |
30 ;; option variables known to loaded Emacs Lisp code. There are two entry | |
31 ;; points, `list-options' and `edit' options'. The latter enters a major | |
32 ;; mode specifically for editing option values. Do `M-x describe-mode' in | |
33 ;; that context for more details. | |
34 | |
35 ;; The customization buffer feature is intended to make this obsolete. | |
36 | |
37 ;;; Code: | |
38 | |
39 ;;;###autoload | |
40 (defun list-options () | |
41 "Display a list of Emacs user options, with values and documentation. | |
42 It is now better to use Customize instead." | |
43 (interactive) | |
44 (with-output-to-temp-buffer "*List Options*" | |
45 (let (vars) | |
71371
a5f28e1a3fa6
(list-options): Put "obsolete" msg in buffer.
Richard M. Stallman <rms@gnu.org>
parents:
68640
diff
changeset
|
46 (princ "This facility is obsolete; we recommend using M-x customize instead.") |
a5f28e1a3fa6
(list-options): Put "obsolete" msg in buffer.
Richard M. Stallman <rms@gnu.org>
parents:
68640
diff
changeset
|
47 |
51342 | 48 (mapatoms (function (lambda (sym) |
49 (if (user-variable-p sym) | |
50 (setq vars (cons sym vars)))))) | |
51 (setq vars (sort vars 'string-lessp)) | |
52 (while vars | |
53 (let ((sym (car vars))) | |
54 (when (boundp sym) | |
55 (princ ";; ") | |
56 (prin1 sym) | |
57 (princ ":\n\t") | |
58 (prin1 (symbol-value sym)) | |
59 (terpri) | |
60 (princ (substitute-command-keys | |
61 (documentation-property sym 'variable-documentation))) | |
62 (princ "\n;;\n")) | |
63 (setq vars (cdr vars)))) | |
64 (with-current-buffer "*List Options*" | |
65 (Edit-options-mode) | |
66 (setq buffer-read-only t))))) | |
67 | |
68 ;;;###autoload | |
69 (defun edit-options () | |
70 "Edit a list of Emacs user option values. | |
71 Selects a buffer containing such a list, | |
72 in which there are commands to set the option values. | |
73 Type \\[describe-mode] in that buffer for a list of commands. | |
74 | |
75 The Custom feature is intended to make this obsolete." | |
76 (interactive) | |
77 (list-options) | |
78 (pop-to-buffer "*List Options*")) | |
79 | |
80 (defvar Edit-options-mode-map | |
81 (let ((map (make-keymap))) | |
82 (define-key map "s" 'Edit-options-set) | |
83 (define-key map "x" 'Edit-options-toggle) | |
84 (define-key map "1" 'Edit-options-t) | |
85 (define-key map "0" 'Edit-options-nil) | |
86 (define-key map "p" 'backward-paragraph) | |
87 (define-key map " " 'forward-paragraph) | |
88 (define-key map "n" 'forward-paragraph) | |
89 map) | |
90 "") | |
91 | |
92 ;; Edit Options mode is suitable only for specially formatted data. | |
93 (put 'Edit-options-mode 'mode-class 'special) | |
94 | |
95 (defun Edit-options-mode () | |
96 "\\<Edit-options-mode-map>\ | |
97 Major mode for editing Emacs user option settings. | |
98 Special commands are: | |
99 \\[Edit-options-set] -- set variable point points at. New value read using minibuffer. | |
100 \\[Edit-options-toggle] -- toggle variable, t -> nil, nil -> t. | |
101 \\[Edit-options-t] -- set variable to t. | |
102 \\[Edit-options-nil] -- set variable to nil. | |
103 Changed values made by these commands take effect immediately. | |
104 | |
105 Each variable description is a paragraph. | |
106 For convenience, the characters \\[backward-paragraph] and \\[forward-paragraph] move back and forward by paragraphs." | |
107 (kill-all-local-variables) | |
108 (set-syntax-table emacs-lisp-mode-syntax-table) | |
109 (use-local-map Edit-options-mode-map) | |
110 (make-local-variable 'paragraph-separate) | |
111 (setq paragraph-separate "[^\^@-\^?]") | |
112 (make-local-variable 'paragraph-start) | |
113 (setq paragraph-start "\t") | |
114 (setq truncate-lines t) | |
115 (setq major-mode 'Edit-options-mode) | |
116 (setq mode-name "Options") | |
62769
a1fa16a75bde
* obsolete/ooutline.el (outline-mode):
Lute Kamstra <lute@gnu.org>
parents:
52401
diff
changeset
|
117 (run-mode-hooks 'Edit-options-mode-hook)) |
51342 | 118 |
119 (defun Edit-options-set () (interactive) | |
120 (Edit-options-modify | |
121 (lambda (var) (eval-minibuffer (concat "New " (symbol-name var) ": "))))) | |
122 | |
123 (defun Edit-options-toggle () (interactive) | |
124 (Edit-options-modify (lambda (var) (not (symbol-value var))))) | |
125 | |
126 (defun Edit-options-t () (interactive) | |
127 (Edit-options-modify (lambda (var) t))) | |
128 | |
129 (defun Edit-options-nil () (interactive) | |
130 (Edit-options-modify (lambda (var) nil))) | |
131 | |
132 (defun Edit-options-modify (modfun) | |
133 (save-excursion | |
134 (let ((buffer-read-only nil) var pos) | |
135 (re-search-backward "^;; \\|\\`") | |
136 (forward-char 3) | |
137 (setq pos (point)) | |
138 (save-restriction | |
139 (narrow-to-region pos (progn (end-of-line) (1- (point)))) | |
140 (goto-char pos) | |
141 (setq var (read (current-buffer)))) | |
142 (goto-char pos) | |
143 (forward-line 1) | |
144 (forward-char 1) | |
145 (save-excursion | |
146 (set var (funcall modfun var))) | |
147 (kill-sexp 1) | |
148 (prin1 (symbol-value var) (current-buffer))))) | |
149 | |
150 (provide 'options) | |
151 | |
93975
1e3a407766b9
Fix up comment convention on the arch-tag lines.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
79715
diff
changeset
|
152 ;; arch-tag: d18211a1-f3fb-48c9-a449-d5acde406a3c |
51342 | 153 ;;; options.el ends here |