Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
emacs
emacs
Commits
c94f4677
Commit
c94f4677
authored
Apr 28, 2000
by
Gerd Moellmann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
*** empty log message ***
parent
030106ca
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
66 additions
and
16 deletions
+66
-16
etc/NEWS
etc/NEWS
+18
-5
lisp/ChangeLog
lisp/ChangeLog
+4
-0
lisp/subr.el
lisp/subr.el
+44
-11
No files found.
etc/NEWS
View file @
c94f4677
...
...
@@ -1150,12 +1150,25 @@ so I will know I still need to look at it -- rms.
** The function `add-minor-mode' simplifies the definition of minor
modes.
- Function: add-minor-mode
SYMBOL NAME MAP
- Function: add-minor-mode
TOGGLE NAME &optional KEYMAP AFTER TOGGLE-FUN
Register a new minor mode. SYMBOL is the name of a buffer-local
variable that is toggled on or off to say whether the minor mode is
active or not. NAME is the string that will appear in the mode line
when the minor mode is active. MAP is the keymap for the minor mode.
Register a new minor mode.
TOGGLE is a symbol which is the name of a buffer-local variable that
is toggled on or off to say whether the minor mode is active or not.
NAME specifies what will appear in the mode line when the minor mode
is active. NAME should be either a string starting with a space, or a
symbol whose value is such a string.
Optional KEYMAP is the keymap for the minor mode that will be added
to `minor-mode-map-alist'.
Optional AFTER specifies that TOGGLE should be added after AFTER
in `minor-mode-alist'.
Optional TOGGLE-FUN is there for compatiblity with other Emacssen.
It is currently not used.
** The function `shell-command' now sets the default directory of the
`*Shell
Command Output*' buffer to the default directory of the buffer
...
...
lisp/ChangeLog
View file @
c94f4677
2000-04-28 Gerd Moellmann <gerd@gnu.org>
* subr.el (add-minor-mode): Rewritten.
2000-04-28 Kenichi Handa <handa@etl.go.jp>
* mail/sendmail.el (sendmail-send-it): Set
...
...
lisp/subr.el
View file @
c94f4677
...
...
@@ -1486,18 +1486,51 @@ If DIR-FLAG is non-nil, create a new empty directory instead of a file."
file
))
(
defun
add-minor-mode
(
symbol
name
&optional
map
)
(
defun
add-minor-mode
(
toggle
name
&optional
keymap
after
toggle-fun
)
"Register a new minor mode.
SYMBOL is the name of a buffer-local variable that is toggled on
or off to say whether the minor mode is active or not. NAME is the
string that will appear in the mode line when the minor mode is
active. Optional MAP is the keymap for the minor mode."
(
make-local-variable
symbol
)
(
set
symbol
t
)
(
unless
(
assq
symbol
minor-mode-alist
)
(
add-to-list
'minor-mode-alist
(
list
symbol
name
)))
(
when
(
and
map
(
not
(
assq
symbol
minor-mode-map-alist
)))
(
add-to-list
'minor-mode-map-alist
(
cons
symbol
map
))))
TOGGLE is a symbol which is the name of a buffer-local variable that
is toggled on or off to say whether the minor mode is active or not.
NAME specifies what will appear in the mode line when the minor mode
is active. NAME should be either a string starting with a space, or a
symbol whose value is such a string.
Optional KEYMAP is the keymap for the minor mode that will be added
to `minor-mode-map-alist'.
Optional AFTER specifies that TOGGLE should be added after AFTER
in `minor-mode-alist'.
Optional TOGGLE-FUN is there for compatiblity with other Emacssen.
It is currently not used."
(
make-local-variable
toggle
)
(
set
toggle
t
)
(
when
name
(
let
((
existing
(
assq
toggle
minor-mode-alist
))
(
name
(
if
(
symbolp
name
)
(
symbol-value
name
)
name
)))
(
cond
((
null
existing
)
(
let
((
tail
minor-mode-alist
)
found
)
(
while
(
and
tail
(
not
found
))
(
if
(
eq
after
(
caar
tail
))
(
setq
found
tail
)
(
setq
tail
(
cdr
tail
))))
(
if
found
(
let
((
rest
(
cdr
found
)))
(
setcdr
found
nil
)
(
nconc
found
(
list
toggle
name
)
rest
))
(
setq
minor-mode-alist
(
cons
(
list
toggle
name
)
minor-mode-alist
)))))
(
t
(
setcdr
existing
(
list
name
))))))
(
when
keymap
(
let
((
existing
(
assq
toggle
minor-mode-map-alist
)))
(
if
existing
(
setcdr
existing
keymap
)
(
setq
minor-mode-map-alist
(
cons
(
cons
toggle
keymap
)
minor-mode-map-alist
))))))
;;; subr.el ends here
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment