Mercurial > emacs
annotate lisp/obsolete/options.el @ 96080:2b046bd8b819
Fix behavior of text-scale-increase when text-scale-mode is disabled
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-1257
author | Miles Bader <miles@gnu.org> |
---|---|
date | Thu, 19 Jun 2008 02:17:16 +0000 |
parents | 43d30a1ea764 |
children | a9dc0e7c3f2b |
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 | |
94667
43d30a1ea764
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
94000
diff
changeset
|
10 ;; GNU Emacs is free software: you can redistribute it and/or modify |
51342 | 11 ;; it under the terms of the GNU General Public License as published by |
94667
43d30a1ea764
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
94000
diff
changeset
|
12 ;; the Free Software Foundation, either version 3 of the License, or |
43d30a1ea764
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
94000
diff
changeset
|
13 ;; (at your option) any later version. |
51342 | 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 | |
94667
43d30a1ea764
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
94000
diff
changeset
|
21 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. |
51342 | 22 |
23 ;;; Commentary: | |
24 | |
94000
ee22366f2a68
Add a comment giving version of obsolescence.
Glenn Morris <rgm@gnu.org>
parents:
93975
diff
changeset
|
25 ;; 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
|
26 |
51342 | 27 ;; This code provides functions to list and edit the values of all global |
28 ;; option variables known to loaded Emacs Lisp code. There are two entry | |
29 ;; points, `list-options' and `edit' options'. The latter enters a major | |
30 ;; mode specifically for editing option values. Do `M-x describe-mode' in | |
31 ;; that context for more details. | |
32 | |
33 ;; The customization buffer feature is intended to make this obsolete. | |
34 | |
35 ;;; Code: | |
36 | |
37 ;;;###autoload | |
38 (defun list-options () | |
39 "Display a list of Emacs user options, with values and documentation. | |
40 It is now better to use Customize instead." | |
41 (interactive) | |
42 (with-output-to-temp-buffer "*List Options*" | |
43 (let (vars) | |
71371
a5f28e1a3fa6
(list-options): Put "obsolete" msg in buffer.
Richard M. Stallman <rms@gnu.org>
parents:
68640
diff
changeset
|
44 (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
|
45 |
51342 | 46 (mapatoms (function (lambda (sym) |
47 (if (user-variable-p sym) | |
48 (setq vars (cons sym vars)))))) | |
49 (setq vars (sort vars 'string-lessp)) | |
50 (while vars | |
51 (let ((sym (car vars))) | |
52 (when (boundp sym) | |
53 (princ ";; ") | |
54 (prin1 sym) | |
55 (princ ":\n\t") | |
56 (prin1 (symbol-value sym)) | |
57 (terpri) | |
58 (princ (substitute-command-keys | |
59 (documentation-property sym 'variable-documentation))) | |
60 (princ "\n;;\n")) | |
61 (setq vars (cdr vars)))) | |
62 (with-current-buffer "*List Options*" | |
63 (Edit-options-mode) | |
64 (setq buffer-read-only t))))) | |
65 | |
66 ;;;###autoload | |
67 (defun edit-options () | |
68 "Edit a list of Emacs user option values. | |
69 Selects a buffer containing such a list, | |
70 in which there are commands to set the option values. | |
71 Type \\[describe-mode] in that buffer for a list of commands. | |
72 | |
73 The Custom feature is intended to make this obsolete." | |
74 (interactive) | |
75 (list-options) | |
76 (pop-to-buffer "*List Options*")) | |
77 | |
78 (defvar Edit-options-mode-map | |
79 (let ((map (make-keymap))) | |
80 (define-key map "s" 'Edit-options-set) | |
81 (define-key map "x" 'Edit-options-toggle) | |
82 (define-key map "1" 'Edit-options-t) | |
83 (define-key map "0" 'Edit-options-nil) | |
84 (define-key map "p" 'backward-paragraph) | |
85 (define-key map " " 'forward-paragraph) | |
86 (define-key map "n" 'forward-paragraph) | |
87 map) | |
88 "") | |
89 | |
90 ;; Edit Options mode is suitable only for specially formatted data. | |
91 (put 'Edit-options-mode 'mode-class 'special) | |
92 | |
93 (defun Edit-options-mode () | |
94 "\\<Edit-options-mode-map>\ | |
95 Major mode for editing Emacs user option settings. | |
96 Special commands are: | |
97 \\[Edit-options-set] -- set variable point points at. New value read using minibuffer. | |
98 \\[Edit-options-toggle] -- toggle variable, t -> nil, nil -> t. | |
99 \\[Edit-options-t] -- set variable to t. | |
100 \\[Edit-options-nil] -- set variable to nil. | |
101 Changed values made by these commands take effect immediately. | |
102 | |
103 Each variable description is a paragraph. | |
104 For convenience, the characters \\[backward-paragraph] and \\[forward-paragraph] move back and forward by paragraphs." | |
105 (kill-all-local-variables) | |
106 (set-syntax-table emacs-lisp-mode-syntax-table) | |
107 (use-local-map Edit-options-mode-map) | |
108 (make-local-variable 'paragraph-separate) | |
109 (setq paragraph-separate "[^\^@-\^?]") | |
110 (make-local-variable 'paragraph-start) | |
111 (setq paragraph-start "\t") | |
112 (setq truncate-lines t) | |
113 (setq major-mode 'Edit-options-mode) | |
114 (setq mode-name "Options") | |
62769
a1fa16a75bde
* obsolete/ooutline.el (outline-mode):
Lute Kamstra <lute@gnu.org>
parents:
52401
diff
changeset
|
115 (run-mode-hooks 'Edit-options-mode-hook)) |
51342 | 116 |
117 (defun Edit-options-set () (interactive) | |
118 (Edit-options-modify | |
119 (lambda (var) (eval-minibuffer (concat "New " (symbol-name var) ": "))))) | |
120 | |
121 (defun Edit-options-toggle () (interactive) | |
122 (Edit-options-modify (lambda (var) (not (symbol-value var))))) | |
123 | |
124 (defun Edit-options-t () (interactive) | |
125 (Edit-options-modify (lambda (var) t))) | |
126 | |
127 (defun Edit-options-nil () (interactive) | |
128 (Edit-options-modify (lambda (var) nil))) | |
129 | |
130 (defun Edit-options-modify (modfun) | |
131 (save-excursion | |
132 (let ((buffer-read-only nil) var pos) | |
133 (re-search-backward "^;; \\|\\`") | |
134 (forward-char 3) | |
135 (setq pos (point)) | |
136 (save-restriction | |
137 (narrow-to-region pos (progn (end-of-line) (1- (point)))) | |
138 (goto-char pos) | |
139 (setq var (read (current-buffer)))) | |
140 (goto-char pos) | |
141 (forward-line 1) | |
142 (forward-char 1) | |
143 (save-excursion | |
144 (set var (funcall modfun var))) | |
145 (kill-sexp 1) | |
146 (prin1 (symbol-value var) (current-buffer))))) | |
147 | |
148 (provide 'options) | |
149 | |
93975
1e3a407766b9
Fix up comment convention on the arch-tag lines.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
79715
diff
changeset
|
150 ;; arch-tag: d18211a1-f3fb-48c9-a449-d5acde406a3c |
51342 | 151 ;;; options.el ends here |