annotate lisp/behavior-defs.el @ 515:768853052061

[xemacs-hg @ 2001-05-07 14:16:55 by yoshiki] Jason's patch "[21.1, 21.2] etc/FTP: mirror site updates", <puiae87qpqx.fsf@cyan.acl.lanl.gov>
author yoshiki
date Mon, 07 May 2001 14:17:28 +0000
parents 7039e6323819
children ed498ef2108b
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
502
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
1 ;;; behavior-defs.el --- definitions of specific behaviors
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
2
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
3 ;; Copyright (C) 2000, 2001 Ben Wing.
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
4
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
5 ;; Author: Ben Wing
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
6 ;; Maintainer: XEmacs Development Team
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
7 ;; Keywords: internal, dumped
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
8
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
9 ;; This file is part of XEmacs.
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
10
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
11 ;; XEmacs is free software; you can redistribute it and/or modify it
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
12 ;; under the terms of the GNU General Public License as published by
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
13 ;; the Free Software Foundation; either version 2, or (at your option)
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
14 ;; any later version.
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
15
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
16 ;; XEmacs is distributed in the hope that it will be useful, but
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
17 ;; WITHOUT ANY WARRANTY; without even the implied warranty of
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
18 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
19 ;; General Public License for more details.
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
20
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
21 ;; You should have received a copy of the GNU General Public License
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
22 ;; along with XEmacs; see the file COPYING. If not, write to the
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
23 ;; Free Software Foundation, 59 Temple Place - Suite 330,
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
24 ;; Boston, MA 02111-1307, USA.
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
25
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
26 ;;; Synched up with: Not in FSF.
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
27
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
28 ;;; Authorship:
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
29
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
30 ;; Created July 2000 by Ben Wing.
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
31
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
32 ;;; Commentary:
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
33
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
34 ;; This file will be dumped with XEmacs.
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
35
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
36 ;;; Code:
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
37
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
38 (require 'behavior)
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
39
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
40 (define-behavior 'mouse-avoidance
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
41 "Mouse avoidance mode"
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
42 :title "Mouse Avoidance"
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
43 :enable #'(lambda ()
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
44 (mouse-avoidance-mode 'animate))
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
45 :disable #'(lambda ()
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
46 (mouse-avoidance-mode 'none)))
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
47
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
48 (define-behavior 'resize-minibuffer
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
49 "When this behavior is enabled, the minibuffer is dynamically resized to
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
50 contain the entire region of text put in it as you type.
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
51
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
52 The maximum height to which the minibuffer can grow is controlled by the
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
53 variable `resize-minibuffer-window-max-height'.
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
54
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
55 The variable `resize-minibuffer-window-exactly' determines whether the
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
56 minibuffer window should ever be shrunk to make it no larger than needed to
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
57 display its contents.
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
58
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
59 When using a window system, it is possible for a minibuffer to be the sole
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
60 window in a frame. Since that window is already its maximum size, the only
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
61 way to make more text visible at once is to increase the size of the frame.
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
62 The variable `resize-minibuffer-frame' controls whether this should be
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
63 done. The variables `resize-minibuffer-frame-max-height' and
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
64 `resize-minibuffer-frame-exactly' are analogous to their window
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
65 counterparts."
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
66 :title "Resize Minibuffer Automatically"
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
67 :enable #'(lambda ()
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
68 (resize-minibuffer-mode 1))
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
69 :disable #'(lambda ()
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
70 (resize-minibuffer-mode -1)))
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
71
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
72 (define-behavior 'func-menu
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
73 "Suppose you have a file with a lot of functions in it. Well, this
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
74 package makes it easy to jump to any of those functions. The names of
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
75 the functions in the current buffer are automatically put into menubar
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
76 menu, you select one of the function-names and the point is moved to
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
77 that very function. The mark is pushed on the mark-ring, so you can
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
78 easily go back to where you were. Alternatively, you can use enter the
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
79 name of the desired function via the minibuffer which offers
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
80 completing read input. In addition, the name of the function before
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
81 point is optionally displayed in the modeline."
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
82 :title "Function Menu"
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
83 :require 'func-menu
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
84 :enable #'(lambda ()
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
85 (add-hook 'find-file-hooks 'fume-add-menubar-entry)
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
86 (mapc #'(lambda (buffer)
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
87 (with-current-buffer buffer
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
88 (setq fume-display-in-modeline-p t)
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
89 (fume-add-menubar-entry)))
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
90 (buffer-list)))
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
91 :disable #'(lambda ()
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
92 (remove-hook 'find-file-hooks 'fume-add-menubar-entry)
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
93 (fset 'widen (symbol-function 'fume-widen))
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
94 (fset 'narrow-to-region (symbol-function 'narrow-to-region))
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
95 (mapc #'(lambda (buffer)
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
96 (with-current-buffer buffer
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
97 (fume-remove-menubar-entry)
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
98 (setq fume-display-in-modeline-p nil)
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
99 (fume-remove-post-command-hook
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
100 'fume-tickle-modeline)
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
101 (fume-remove-post-command-hook
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
102 'fume-maybe-install-modeline-feature)
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
103 (fume-remove-post-command-hook
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
104 'fume-rescan-buffer-trigger)))
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
105 (buffer-list))))
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
106
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
107 (define-behavior 'mwheel
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
108 "This code enables the use of the infamous 'wheel' on the new
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
109 crop of mice. Under XFree86 and the XSuSE X Servers, the wheel
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
110 events are sent as button4/button5 events, which are automatically
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
111 set up to do scrolling in the expected way. The actual way that the
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
112 scrolling works can be controlled by `mwheel-scroll-amount' and
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
113 `mwheel-follow-mouse'."
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
114 :title "Mouse Wheel Support"
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
115 :enable 'mwheel-install)
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
116
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
117 (define-behavior 'recent-files
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
118 "Recent-files adds the menu \"Recent Files\" (or whatever name you
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
119 choose, see \"Customization:\" below) to Emacs's menubar. Its
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
120 entries are the files (and directories) that have recently been
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
121 opened by Emacs. You can open one of these files again by
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
122 selecting its entry in the \"Recent Files\" menu. The list of file
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
123 entries in this menu is preserved from one Emacs session to
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
124 another. You can prevent Emacs from saving this list by selecting
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
125 \"Don't save recent-files list on exit\" from the menu. If you have
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
126 disabled saving, you can re-enable it by selecting \"Save
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
127 recent-files list on exit\".
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
128
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
129 The menu has permanent and non-permanent entries. Permanent
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
130 entries are marked with an asterisk in front of the filename. The
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
131 non-permanent entries are hidden in a submenu.
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
132
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
133 Each time you open a file in Emacs, it is added as a non-permanent
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
134 entry to the menu. The value of `recent-files-number-of-entries'
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
135 determines how many non-permanent entries are held in the
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
136 menu. When the number of non-permanent entries reaches this value,
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
137 the least recently added non-permanent entry is removed from the
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
138 menu when another non-permanent entry is added. It is not removed
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
139 from the list, though; it may reappear when entries are deleted
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
140 from the list. The number of entries saved to disk is the value of
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
141 the variable `recent-files-number-of-saved-entries'.
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
142
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
143 Permanent entries are not removed from the menu. You can make a
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
144 file entry permanent by selecting \"Make <buffer> permanent\" (where
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
145 <buffer> is the name of the current buffer) when the current
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
146 buffer holds this file. \"Make <buffer> non-permanent\" makes the
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
147 file entry of the current buffer non-permanent.
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
148
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
149 The command \"Kill buffer <buffer> and delete entry\" is handy when
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
150 you have accidently opened a file but want to keep neither the
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
151 buffer nor the entry.
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
152
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
153 You can erase the list of non-permanent entries by selecting
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
154 \"Erase non-permanent entries\" from the menu.
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
155
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
156 Customization:
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
157
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
158 There are lots of variables to control the behaviour of
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
159 recent-files. You do not have to change any of them if you like it
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
160 as it comes out of the box. However, you may want to look at these
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
161 options to make it behave different.
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
162
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
163 `recent-files-number-of-entries'
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
164 Controls how many non-permanent entries are shown in the
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
165 recent-files list. The default is 15.
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
166
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
167 `recent-files-number-of-saved-entries'
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
168 Controls how many non-permanent entries are saved to disk when
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
169 Emacs exits or recent-files-save-the-list is called. The
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
170 default is 50.
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
171
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
172 `recent-files-save-file'
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
173 The name of the file where the recent-files list is saved
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
174 between Emacs session. You probably don't need to change this.
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
175 The default is \".recent-files.el\" in your home directory.
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
176
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
177 `recent-files-dont-include'
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
178 A list of regular expressions for files that should not be
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
179 included into the recent-files list. This list is empty by
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
180 default. For instance, a list to exclude all .newsrc
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
181 files, all auto-save-files, and all files in the /tmp
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
182 directory (but not the /tmp directory itself) would look
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
183 like this:
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
184 (setq recent-files-dont-include
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
185 '(\"/\\.newsrc\" \"~$\" \"^/tmp/.\"))
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
186 The default is empty.
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
187
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
188 `recent-files-use-full-names'
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
189 If the value of this variable is non-nil, the full pathnames of
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
190 the files are shown in the recent-files menu. Otherwise only
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
191 the filename part (or the last name component if it is a
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
192 directory) is shown in the menu. The default it t, i.e. show
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
193 full names.
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
194
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
195 `recent-files-filename-replacements'
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
196 This is a list of pairs of regular expressions and replacement
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
197 strings. If a filename matches one of the regular expressions,
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
198 the matching part is replaced by the replacement string for
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
199 display in the recent-files menu.
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
200 Example: My home directory is \"/users/mmc/nickel/\". I want to
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
201 replace it with \"~/\". I also want to replace the directory
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
202 \"/imports/teleservices/mmc/avc2/\", where I work a lot, with
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
203 \".../avc2/\". The list then looks like
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
204 (setq recent-files-filename-replacements
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
205 '((\"/users/mmc/nickel/\" . \"~/\")
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
206 (\"/imports/teleservices/mmc/avc2/\" . \".../avc2/\")))
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
207 Only the first match is replaced. So, if you have several
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
208 entries in this list that may match a filename simultaneously,
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
209 put the one you want to match (usually the most special) in
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
210 front of the others. The default is to replace the home
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
211 directory with \"~\".
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
212
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
213 `recent-files-sort-function'
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
214 Contains a function symbol to sort the display of filenames in
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
215 the recent-files menu. Supplied are two functions,
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
216 'recent-files-dont-sort and 'recent-files-sort-alphabetically.
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
217 The first, which is the default, preserves the order of \"most
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
218 recent on top\".
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
219
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
220 `recent-files-permanent-submenu'
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
221 If this variable is non-nil, the permanent entries are put into
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
222 a separate submenu of the recent-files menu. The default is
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
223 nil.
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
224
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
225 `recent-files-non-permanent-submenu'
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
226 If this variable is non-nil, the non-permanent entries are put
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
227 into a separate submenu of the recent-files menu. The default
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
228 is nil. (You can set both `recent-files-permanent-submenu' and
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
229 `recent-files-non-permanent-submenu' to t to have both lists in
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
230 separate submenus.)
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
231
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
232 `recent-files-commands-submenu'
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
233 If this variable is non-nil, the commands if recent-files are
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
234 placed in a submenu of the recent-files menu. The default is
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
235 nil.
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
236
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
237 `recent-files-commands-submenu-title'
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
238 If the commands are placed in a submenu, this string is used as
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
239 the title of the submenu. The default is \"Commands...\".
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
240
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
241 `recent-files-actions-on-top'
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
242 If this variable is non-nil, the \"action\" menu entries (\"Make
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
243 <buffer> permanent\" etc.) are put on top of the menu. Otherwise
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
244 they appear below the file entries or submenus. The default is
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
245 nil.
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
246
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
247 `recent-files-permanent-first'
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
248 If this variable is t, the permanent entries are put first in
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
249 the recent-files menu, i.e. above the non-permanent entries. If
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
250 the value is nil, non-permanent entries appear first. If the
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
251 value is neither t nor nil, the entries are sorted according to
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
252 recent-files-sort-function. The default is 'sort.
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
253
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
254 `recent-files-find-file-command'
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
255 This variable contains to commandto execute when a file entry
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
256 is selected from the menu. Usually this will be `find-file',
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
257 which is the default.
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
258
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
259 KNOWN BUG:
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
260 - recent-files overwrites the recent-files-save-file
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
261 unconditionally when Emacs exits. If you have two Emacs
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
262 processes running, the one exiting later will overwrite the
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
263 file without merging in the new entries from the other Emacs
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
264 process. This can be avoided by disabling the save on exit from
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
265 the menu."
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
266 :title "Recent Files Menu"
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
267 :enable 'recent-files-initialize)
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
268
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
269 (define-behavior 'filladapt
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
270 "These functions enhance the default behavior of Emacs' Auto Fill
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
271 mode and the commands `fill-paragraph', `lisp-fill-paragraph',
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
272 `fill-region-as-paragraph' and `fill-region'.
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
273
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
274 The chief improvement is that the beginning of a line to be
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
275 filled is examined and, based on information gathered, an
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
276 appropriate value for fill-prefix is constructed. Also the
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
277 boundaries of the current paragraph are located. This occurs
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
278 only if the fill prefix is not already non-nil.
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
279
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
280 The net result of this is that blurbs of text that are offset
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
281 from left margin by asterisks, dashes, and/or spaces, numbered
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
282 examples, included text from USENET news articles, etc. are
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
283 generally filled correctly with no fuss."
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
284 :title "Adaptive Filling"
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
285 :require 'filladapt
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
286 :enable #'(lambda ()
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
287 (setq-default filladapt-mode t)
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
288 (mapc #'(lambda (buffer)
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
289 (with-current-buffer buffer
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
290 (unless filladapt-mode
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
291 (filladapt-mode 1))))
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
292 (buffer-list)))
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
293 :disable #'(lambda ()
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
294 (setq-default filladapt-mode nil)
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
295 (mapc #'(lambda (buffer)
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
296 (with-current-buffer buffer
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
297 (when filladapt-mode
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
298 (filladapt-mode -1))))
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
299 (buffer-list))))