annotate lisp/obsolete/options.el @ 93541:f924a28b09bd

* callint.c (Vshift_select_mode): New var. (Finteractive): Document new ^ spec. (Fcall_interactively): Call handle-shift-selection if the ^ spec is present. * keyboard.c (Vthis_command_keys_shift_translated): New var. (command_loop_1): Avoid running the direct display versions of forward-char and backward-char if shift-selection may occur. Don't change the value of transient-mark-mode; this is now handled by handle-shift-selection. (read_key_sequence): Set Vthis_command_keys_shift_translated if shift-translation takes place. * buffer.c (Vtransient_mark_mode): Move docstring to simple.el to avoid clobbering by define-minor-mode. * cmds.c (Fforward_char, Fbackward_char, Fforward_line) (Fbeginning_of_line, Fend_of_line): Add ^ interactive spec. * syntax.c (Fforward_word): Add ^ interactive spec. * window.c (Fscroll_up, Fscroll_down, Fscroll_left) (Fscroll_right): Add ^ interactive spec.
author Chong Yidong <cyd@stupidchicken.com>
date Wed, 02 Apr 2008 20:14:17 +0000
parents e68f97372143
children 606f2d163a64 1e3a407766b9
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
51342
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
1 ;;; options.el --- edit Options command for Emacs
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
2
74509
f7702c5f335d Update copyright years.
Glenn Morris <rgm@gnu.org>
parents: 71371
diff changeset
3 ;; Copyright (C) 1985, 2001, 2002, 2003, 2004, 2005,
79715
e68f97372143 Add 2008 to copyright years.
Glenn Morris <rgm@gnu.org>
parents: 78228
diff changeset
4 ;; 2006, 2007, 2008 Free Software Foundation, Inc.
51342
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
5
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
6 ;; Maintainer: FSF
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
7
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
8 ;; This file is part of GNU Emacs.
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
9
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
10 ;; GNU Emacs is free software; you can redistribute it and/or modify
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
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
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
13 ;; any later version.
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
14
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
15 ;; GNU Emacs is distributed in the hope that it will be useful,
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
16 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
18 ;; GNU General Public License for more details.
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
19
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
20 ;; You should have received a copy of the GNU General Public License
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
21 ;; along with GNU Emacs; see the file COPYING. If not, write to the
64085
18a818a2ee7c Update FSF's address.
Lute Kamstra <lute@gnu.org>
parents: 62769
diff changeset
22 ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18a818a2ee7c Update FSF's address.
Lute Kamstra <lute@gnu.org>
parents: 62769
diff changeset
23 ;; Boston, MA 02110-1301, USA.
51342
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
24
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
25 ;;; Commentary:
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
26
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
27 ;; This code provides functions to list and edit the values of all global
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
28 ;; option variables known to loaded Emacs Lisp code. There are two entry
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
29 ;; points, `list-options' and `edit' options'. The latter enters a major
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
30 ;; mode specifically for editing option values. Do `M-x describe-mode' in
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
31 ;; that context for more details.
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
32
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
33 ;; The customization buffer feature is intended to make this obsolete.
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
34
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
35 ;;; Code:
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
36
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
37 ;;;###autoload
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
38 (defun list-options ()
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
39 "Display a list of Emacs user options, with values and documentation.
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
40 It is now better to use Customize instead."
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
41 (interactive)
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
42 (with-output-to-temp-buffer "*List Options*"
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
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
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
46 (mapatoms (function (lambda (sym)
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
47 (if (user-variable-p sym)
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
48 (setq vars (cons sym vars))))))
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
49 (setq vars (sort vars 'string-lessp))
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
50 (while vars
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
51 (let ((sym (car vars)))
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
52 (when (boundp sym)
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
53 (princ ";; ")
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
54 (prin1 sym)
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
55 (princ ":\n\t")
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
56 (prin1 (symbol-value sym))
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
57 (terpri)
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
58 (princ (substitute-command-keys
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
59 (documentation-property sym 'variable-documentation)))
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
60 (princ "\n;;\n"))
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
61 (setq vars (cdr vars))))
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
62 (with-current-buffer "*List Options*"
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
63 (Edit-options-mode)
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
64 (setq buffer-read-only t)))))
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
65
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
66 ;;;###autoload
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
67 (defun edit-options ()
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
68 "Edit a list of Emacs user option values.
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
69 Selects a buffer containing such a list,
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
70 in which there are commands to set the option values.
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
71 Type \\[describe-mode] in that buffer for a list of commands.
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
72
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
73 The Custom feature is intended to make this obsolete."
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
74 (interactive)
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
75 (list-options)
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
76 (pop-to-buffer "*List Options*"))
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
77
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
78 (defvar Edit-options-mode-map
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
79 (let ((map (make-keymap)))
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
80 (define-key map "s" 'Edit-options-set)
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
81 (define-key map "x" 'Edit-options-toggle)
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
82 (define-key map "1" 'Edit-options-t)
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
83 (define-key map "0" 'Edit-options-nil)
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
84 (define-key map "p" 'backward-paragraph)
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
85 (define-key map " " 'forward-paragraph)
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
86 (define-key map "n" 'forward-paragraph)
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
87 map)
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
88 "")
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
89
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
90 ;; Edit Options mode is suitable only for specially formatted data.
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
91 (put 'Edit-options-mode 'mode-class 'special)
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
92
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
93 (defun Edit-options-mode ()
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
94 "\\<Edit-options-mode-map>\
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
95 Major mode for editing Emacs user option settings.
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
96 Special commands are:
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
97 \\[Edit-options-set] -- set variable point points at. New value read using minibuffer.
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
98 \\[Edit-options-toggle] -- toggle variable, t -> nil, nil -> t.
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
99 \\[Edit-options-t] -- set variable to t.
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
100 \\[Edit-options-nil] -- set variable to nil.
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
101 Changed values made by these commands take effect immediately.
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
102
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
103 Each variable description is a paragraph.
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
104 For convenience, the characters \\[backward-paragraph] and \\[forward-paragraph] move back and forward by paragraphs."
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
105 (kill-all-local-variables)
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
106 (set-syntax-table emacs-lisp-mode-syntax-table)
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
107 (use-local-map Edit-options-mode-map)
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
108 (make-local-variable 'paragraph-separate)
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
109 (setq paragraph-separate "[^\^@-\^?]")
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
110 (make-local-variable 'paragraph-start)
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
111 (setq paragraph-start "\t")
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
112 (setq truncate-lines t)
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
113 (setq major-mode 'Edit-options-mode)
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
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
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
116
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
117 (defun Edit-options-set () (interactive)
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
118 (Edit-options-modify
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
119 (lambda (var) (eval-minibuffer (concat "New " (symbol-name var) ": ")))))
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
120
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
121 (defun Edit-options-toggle () (interactive)
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
122 (Edit-options-modify (lambda (var) (not (symbol-value var)))))
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
123
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
124 (defun Edit-options-t () (interactive)
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
125 (Edit-options-modify (lambda (var) t)))
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
126
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
127 (defun Edit-options-nil () (interactive)
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
128 (Edit-options-modify (lambda (var) nil)))
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
129
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
130 (defun Edit-options-modify (modfun)
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
131 (save-excursion
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
132 (let ((buffer-read-only nil) var pos)
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
133 (re-search-backward "^;; \\|\\`")
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
134 (forward-char 3)
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
135 (setq pos (point))
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
136 (save-restriction
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
137 (narrow-to-region pos (progn (end-of-line) (1- (point))))
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
138 (goto-char pos)
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
139 (setq var (read (current-buffer))))
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
140 (goto-char pos)
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
141 (forward-line 1)
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
142 (forward-char 1)
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
143 (save-excursion
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
144 (set var (funcall modfun var)))
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
145 (kill-sexp 1)
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
146 (prin1 (symbol-value var) (current-buffer)))))
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
147
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
148 (provide 'options)
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
149
52401
695cf19ef79e Add arch taglines
Miles Bader <miles@gnu.org>
parents: 51342
diff changeset
150 ;;; arch-tag: d18211a1-f3fb-48c9-a449-d5acde406a3c
51342
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
151 ;;; options.el ends here