comparison lisp/prim/options.el @ 4:b82b59fe008d r19-15b3

Import from CVS: tag r19-15b3
author cvs
date Mon, 13 Aug 2007 08:46:56 +0200
parents 376386a54a3c
children 131b0175ea99
comparison
equal deleted inserted replaced
3:30df88044ec6 4:b82b59fe008d
16 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 ;; General Public License for more details. 17 ;; General Public License for more details.
18 18
19 ;; You should have received a copy of the GNU General Public License 19 ;; You should have received a copy of the GNU General Public License
20 ;; along with XEmacs; see the file COPYING. If not, write to the Free 20 ;; along with XEmacs; see the file COPYING. If not, write to the Free
21 ;; Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. 21 ;; Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
22 ;; 02111-1307, USA.
22 23
23 ;;; Synched up with: FSF 19.30. 24 ;;; Synched up with: FSF 19.34.
24 25
25 ;;; Commentary: 26 ;;; Commentary:
26 27
27 ;; This code provides functions to list and edit the values of all global 28 ;; 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 ;; option variables known to loaded Emacs Lisp code. There are two entry
39 (save-excursion 40 (save-excursion
40 (set-buffer (get-buffer-create "*List Options*")) 41 (set-buffer (get-buffer-create "*List Options*"))
41 (Edit-options-mode)) 42 (Edit-options-mode))
42 (with-output-to-temp-buffer "*List Options*" 43 (with-output-to-temp-buffer "*List Options*"
43 (let (vars) 44 (let (vars)
44 (mapatoms #'(lambda (sym) 45 (mapatoms #'(lambda (sym) ; XEmacs
45 (if (user-variable-p sym) 46 (if (user-variable-p sym)
46 (setq vars (cons sym vars))))) 47 (setq vars (cons sym vars)))))
47 (setq vars (sort vars 'string-lessp)) 48 (setq vars (sort vars 'string-lessp))
48 (while vars 49 (while vars
49 (let ((sym (car vars))) 50 (let ((sym (car vars)))
50 (princ ";; ") 51 (princ ";; ")
51 (prin1 sym) 52 (prin1 sym)
52 (princ ":\n\t") 53 (princ ":\n\t")
53 (if (boundp sym) 54 (if (boundp sym) ; XEmacs
54 (prin1 (symbol-value sym)) 55 (prin1 (symbol-value sym))
55 (princ "#<unbound>")) 56 (princ "#<unbound>"))
56 (terpri) 57 (terpri)
57 (princ (substitute-command-keys 58 (princ (substitute-command-keys
58 (documentation-property sym 'variable-documentation))) 59 (documentation-property sym 'variable-documentation)))
106 (setq paragraph-separate "[^\^@-\^?]") 107 (setq paragraph-separate "[^\^@-\^?]")
107 (make-local-variable 'paragraph-start) 108 (make-local-variable 'paragraph-start)
108 (setq paragraph-start "\t") 109 (setq paragraph-start "\t")
109 (setq truncate-lines t) 110 (setq truncate-lines t)
110 (setq major-mode 'Edit-options-mode) 111 (setq major-mode 'Edit-options-mode)
111 (setq mode-name (gettext "Options")) 112 (setq mode-name (gettext "Options")) ; XEmacs
112 (run-hooks 'Edit-options-mode-hook)) 113 (run-hooks 'Edit-options-mode-hook))
113 114
114 (defun Edit-options-set () (interactive) 115 (defun Edit-options-set () (interactive)
115 (Edit-options-modify 116 (Edit-options-modify
116 '(lambda (var) (eval-minibuffer (format "New %s:" (symbol-name var)))))) 117 '(lambda (var) (eval-minibuffer (concat "New " (symbol-name var) ": ")))))
117 118
118 (defun Edit-options-toggle () (interactive) 119 (defun Edit-options-toggle () (interactive)
119 (Edit-options-modify '(lambda (var) (not (symbol-value var))))) 120 (Edit-options-modify '(lambda (var) (not (symbol-value var)))))
120 121
121 (defun Edit-options-t () (interactive) 122 (defun Edit-options-t () (interactive)
129 (let ((buffer-read-only nil) var pos) 130 (let ((buffer-read-only nil) var pos)
130 (re-search-backward "^;; \\|\\`") 131 (re-search-backward "^;; \\|\\`")
131 (forward-char 3) 132 (forward-char 3)
132 (setq pos (point)) 133 (setq pos (point))
133 (save-restriction 134 (save-restriction
134 (narrow-to-region pos (progn (end-of-line) (1- (point)))) 135 (narrow-to-region pos (progn (end-of-line) (1- (point))))
135 (goto-char pos) 136 (goto-char pos)
136 (setq var (read (current-buffer)))) 137 (setq var (read (current-buffer))))
137 (goto-char pos) 138 (goto-char pos)
138 (forward-line 1) 139 (forward-line 1)
139 (forward-char 1) 140 (forward-char 1)
140 (save-excursion 141 (save-excursion
141 (set var (funcall modfun var))) 142 (set var (funcall modfun var)))
142 (kill-sexp 1) 143 (kill-sexp 1)
143 (prin1 (symbol-value var) (current-buffer))))) 144 (prin1 (symbol-value var) (current-buffer)))))
144 145
145 ;;; options.el ends here 146 ;;; options.el ends here