Commit graph

214 commits

Author SHA1 Message Date
Lars Ingebrigtsen
32b9c7d06f Revert "Allow nil initializers in define-minor-mode"
This reverts commit 02cbb37de7.

This was mistakenly commited and doesn't really make much sense.
2021-07-31 13:37:42 +02:00
Lars Ingebrigtsen
02cbb37de7 Allow nil initializers in define-minor-mode
* lisp/emacs-lisp/easy-mmode.el (define-minor-mode): Make the
meaning of :initialize nil and a missing :initialize the same.
2021-07-31 12:35:45 +02:00
Lars Ingebrigtsen
46a66c6248 Make the minor mode doc strings say that they're minor modes
* lisp/emacs-lisp/easy-mmode.el (easy-mmode--arg-docstring):
Mention that this is a minor mode (bug#20462).
2021-06-30 15:31:26 +02:00
Lars Ingebrigtsen
3c0b50d1fc Make minor mode docstrings say what the mode "variable" is
* lisp/emacs-lisp/easy-mmode.el (easy-mmode--arg-docstring): Add
the mode variable (bug#36500).
(easy-mmode--mode-docstring):
(define-minor-mode): Pass in the getter.
2021-06-22 16:03:37 +02:00
Stefan Monnier
9e5290aecf * lisp/emacs-lisp/easy-mmode.el (define-minor-mode): Fix bug#47925
In order to correctly detect the case of the "new style" with an empty body,
remove the old optional arguments `init-value`, `lighter`, and `keymap`,
so we can distinguish the "nil arg" from the "absent arg" cases.
2021-04-20 19:40:09 -04:00
Stefan Monnier
556c23cd17 * lisp/emacs-lisp/easy-mmode.el (define-minor-mode): Tweak further
Suggested by Lars Ingebrigtsen <larsi@gnus.org>.
2021-04-17 09:57:01 -04:00
Stefan Monnier
d262138383 * lisp/emacs-lisp/easy-mmode.el (define-minor-mode): Improve C-h f output
Suggested by Michael Heerdegen <michael_heerdegen@web.de>.
2021-04-16 23:40:51 -04:00
Stefan Monnier
6bec60ad31 (define-minor-mode): Warn about use of pre-Emacs-21 style args
* lisp/emacs-lisp/easy-mmode.el (define-minor-mode):
Use `advertised-calling-convention` to avoid promoting the old
style arguments.  Emit a wanring when old-style arguments are used.
Massage the docstring accordingly.
* doc/lispref/modes.texi (Defining Minor Modes): Document the keyword
arguments rather than the old-style positional arguments.
2021-04-12 11:08:19 -04:00
Lars Ingebrigtsen
d0125959d7 Make byte-compiled uses of `define-minor-mode' more compatible
* lisp/emacs-lisp/easy-mmode.el (define-minor-mode): Be more
defensive about accessing minor mode variables.
2021-03-12 00:41:54 +01:00
Lars Ingebrigtsen
b535c8ba87 Add a new variable `global-minor-modes'
* doc/lispref/modes.texi (Minor Modes): Document it.
* lisp/simple.el (global-minor-modes): New variable.
(completion-in-mode-p): Use it.
(completion-with-modes-p): Use it.

* lisp/emacs-lisp/easy-mmode.el (define-minor-mode): Support it.
2021-02-15 13:08:21 +01:00
Lars Ingebrigtsen
0bd846c174 Rename minor-modes to local-minor-modes
* doc/lispref/modes.texi (Minor Modes): Update documentation.
* lisp/simple.el (completion-with-modes-p): Change usage.

* lisp/emacs-lisp/easy-mmode.el (define-minor-mode): Change usage.

* src/buffer.c: Rename from minor_modes to local_minor_modes
throughout.
(syms_of_buffer): Rename minor-modes to local-minor-modes.

* src/buffer.h (struct buffer): Rename minor_modes_.

* src/pdumper.c (dump_buffer): Update hash and usage.
2021-02-15 13:08:21 +01:00
Lars Ingebrigtsen
2f00a3435a Don't update `minor-modes' in global modes
* lisp/emacs-lisp/easy-mmode.el (define-minor-mode): There's no
point in setting the buffer-local `minor-modes' in global modes.
2021-02-14 16:51:14 +01:00
Lars Ingebrigtsen
869cdcf4e7 Really fix the syntax problem in define-minor-mode
* lisp/emacs-lisp/easy-mmode.el (define-minor-mode): Fix
interactive extension in previous change.
2021-02-14 14:13:38 +01:00
Lars Ingebrigtsen
07e6b29b12 Fix previous define-minor-mode change
* lisp/emacs-lisp/easy-mmode.el (define-minor-mode): Fix
interactive extension in previous change.
2021-02-14 14:12:08 +01:00
Lars Ingebrigtsen
40f7804ecb Allow define-minor-mode to take an :interactive keyword
* lisp/emacs-lisp/easy-mmode.el (define-minor-mode): Allow
specifying the :interactive state and the modes.
2021-02-14 14:06:16 +01:00
Lars Ingebrigtsen
760910f491 Add a new buffer-local variable `minor-modes'
* lisp/emacs-lisp/easy-mmode.el (define-minor-mode): Keep
`minor-modes' updated.
* src/buffer.c (bset_minor_modes, Fmake_indirect_buffer)
(reset_buffer, init_buffer_once): Initialise `minor-modes'.
(syms_of_buffer): Add `minor-modes' as a new permanently-local
variable.

* src/buffer.h (struct buffer): Add minor_modes_.
2021-02-14 12:37:44 +01:00
Lars Ingebrigtsen
e1d54bb638 Allow a :variable keyword in define-globalized-minor-mode
* doc/lispref/modes.texi (Defining Minor Modes): Document it.
* lisp/emacs-lisp/easy-mmode.el (define-globalized-minor-mode):
Allow specifying a :variable to be used if the underlying mode has
a divergent variable to store the state (bug#29081).
2021-02-04 15:22:40 +01:00
Stefan Kangas
5f69c222f4 Prefer defvar-local in emacs-lisp/*.el
* lisp/emacs-lisp/chart.el (chart-local-object):
* lisp/emacs-lisp/easy-mmode.el (define-minor-mode)
(define-globalized-minor-mode):
* lisp/emacs-lisp/edebug.el:
* lisp/emacs-lisp/generic.el (generic-font-lock-keywords):
* lisp/emacs-lisp/re-builder.el (reb-regexp, reb-regexp-src)
(reb-overlays):
* lisp/emacs-lisp/syntax.el
(syntax-propertize-extend-region-functions): Prefer defvar-local.
2021-01-31 14:55:53 +01:00
Paul Eggert
ba05d005e5 Update copyright year to 2021
Run "TZ=UTC0 admin/update-copyright".
2021-01-01 01:13:56 -08:00
Stefan Kangas
6b8bb47ac0 Fill some auto-generated docstrings
* lisp/emacs-lisp/easy-mmode.el (define-minor-mode)
(define-globalized-minor-mode): Fill auto-generated documentation
strings.  (Bug#44858)
* lisp/subr.el (internal--fill-string-single-line)
(internal--format-docstring-line): New functions.
2020-12-28 06:26:52 +01:00
Lars Ingebrigtsen
5cea77af41 Partially revert previous define-minor-mode change
* lisp/emacs-lisp/easy-mmode.el (easy-mmode--arg-docstring):
Only document the values we want to support, not the ones we
actually support.
(define-minor-mode): Partially revert to previous behaviour.
2020-11-02 10:17:08 +01:00
Glenn Morris
8761c155e4 * lisp/emacs-lisp/easy-mmode.el (easy-mmode--arg-docstring): Doc typo. 2020-11-01 09:39:44 -08:00
Lars Ingebrigtsen
2a4b0da28c Make minor mode ARG work as documented
* lisp/emacs-lisp/easy-mmode.el (easy-mmode--arg-docstring):
Clarify when minor modes are switched on/off when called from lisp
(bug#44341).
(define-minor-mode): Make calls from Lisp switch the mode on/off
as documented.
2020-11-01 15:00:44 +01:00
Lars Ingebrigtsen
f314ac2a30 Make the -modes variable autoloaded
* lisp/emacs-lisp/easy-mmode.el (define-globalized-minor-mode):
Make the -modes variable be autoloaded.
2020-10-26 20:44:21 +01:00
Lars Ingebrigtsen
b8b18cf34a Implement a :predicate parameter for globalized minor modes
* doc/lispref/modes.texi (Defining Minor Modes): Describe the new
:predicate keyword (bug#44232).

* lisp/emacs-lisp/easy-mmode.el (define-globalized-minor-mode):
Allow a new :predicate keyword.
(easy-mmode--globalized-predicate-p): New function.
2020-10-26 19:15:36 +01:00
Stefan Monnier
46c0f28c0e * lisp/emacs-lisp/easy-mmode.el (define-minor-mode): Doc tweak
Try and clarify the meaning of `init-value`.
2020-10-10 11:07:28 -04:00
Lars Ingebrigtsen
144bbfc662 Allow customizing hooks defined via define-minor-mode
* lisp/emacs-lisp/easy-mmode.el (define-minor-mode): Allow using
Customize on the hooks (bug#10773).
2020-09-19 17:21:02 +02:00
Stefan Monnier
6e7736ac5f (define-minor-mode): Don't compute a default :group (bug#41145)
* lisp/emacs-lisp/easy-mmode.el (define-minor-mode): Rely on the
`defcustom`s own defaulting for the :group.

* lisp/display-fill-column-indicator.el
(global-display-fill-column-indicator-mode): Remove now redundant :group.

* lisp/cus-dep.el (custom--get-def): New function.
(custom-make-dependencies): Use it.
2020-09-09 13:30:20 -04:00
Lars Ingebrigtsen
348686b3f3 Minor mode doc string clarification
* lisp/emacs-lisp/easy-mmode.el (easy-mmode--arg-docstring):
Clarify that the minor mode hook is called both when enabling and
disabling the mode (bug#34073).
2020-08-21 17:15:22 +02:00
Paul Eggert
365e01cc9f Update copyright year to 2020
Run "TZ=UTC0 admin/update-copyright $(git ls-files)".
2020-01-01 00:59:52 +00:00
Lars Ingebrigtsen
a1dbb81f18 Fix some &rest body edebug specs
* lisp/ses.el (ses--letref):

* lisp/emacs-lisp/crm.el (crm--completion-command): Fix edebug
&rest body spec (bug#28747).

* lisp/emacs-lisp/easy-mmode.el (easy-mmode-define-navigation):

* lisp/emacs-lisp/inline.el (inline--leteval)
(inline--letlisteval, inline-letevals):
2019-10-16 04:44:22 +02:00
Juanma Barranquero
bbfa9995ff Improve docstrings auto-generated by `define-minor-mode'
* lisp/emacs-lisp/easy-mmode.el (easy-mmode--mode-docstring):
When using `easy-mmode--arg-docstring' to auto-generate a
docstring, refill it up to `emacs-lisp-docstring-fill-column'.
2019-10-05 00:31:17 +02:00
Juanma Barranquero
4df55f8f2f Revert "Improve docstrings auto-generated by `define-minor-mode'"
This reverts commit a397fa06d1.
The original change breaks bootstrapping because of a circular dependency.
2019-10-04 14:03:11 +02:00
Juanma Barranquero
a397fa06d1 Improve docstrings auto-generated by `define-minor-mode'
* lisp/emacs-lisp/easy-mmode.el (easy-mmode--mode-docstring):
When using `easy-mmode--arg-docstring' to auto-generate a
docstring, refill it up to `emacs-lisp-docstring-fill-column'.
2019-10-04 01:26:56 +02:00
Lars Ingebrigtsen
bc95fc78bb Make the help page mention the customizeable global mode variable
* lisp/help-fns.el (help-fns--customize-variable): Factor out into
own function for reuse.
(help-fns--globalized-minor-mode): Use it to mention the
equivalent variable.

* lisp/emacs-lisp/easy-mmode.el (define-globalized-minor-mode):
Mark globalized minor modes as such (bug#7177).
2019-10-01 16:45:24 +02:00
Noam Postavsky
7e2090ee80 Respect global-eldoc-mode in minibuffers (Bug#36886)
* lisp/emacs-lisp/easy-mmode.el (define-globalized-minor-mode): Accept
a BODY parameter.
* doc/lispref/modes.texi (Defining Minor Modes): Document new
parameter.
* etc/NEWS: Announce it.

* lisp/simple.el (read--expression): Move eldoc-mode setup to...
* lisp/emacs-lisp/eldoc.el (eldoc--eval-expression-setup): ... here,
new function.
(global-eldoc-mode): Add or remove it to
eval-expression-minibuffer-setup-hook when enabling or disabling
global-eldoc-mode.  This enables eldoc in the minibuffer (solving
Bug#27202), only when global-eldoc-mode is enabled.
2019-08-20 20:20:52 -04:00
Stefan Monnier
c8ec3108a3 * easy-mmode.el: simplify via custom-current-group
* lisp/emacs-lisp/easy-mmode.el (define-globalized-minor-mode):
Don't try and guess a default :group, defcustom does it better anyway.
2019-03-26 11:45:07 -04:00
Stefan Monnier
7dda131ab0 * lisp/emacs-lisp/easy-mmode.el: Fix most obvious bug#34723
(easy-mmode-define-navigation): Don't scroll in the opposite direction of
the movement.
2019-03-13 15:55:39 -04:00
Charles A. Roelli
9f7212ad42 Simplify easy-mmode-define-navigation
* lisp/emacs-lisp/easy-mmode.el (easy-mmode-define-navigation):
Simplify a one-argument call to "or" and use buffer-narrowed-p instead
of checking that condition by hand.
2019-02-19 19:54:44 +01:00
Paul Eggert
ba809612c0 Merge from origin/emacs-26
2fcf2df Fix copyright years by hand
26bed8b Update copyright year to 2019
2814292 Fix value of default frame height.  (Bug#33921)
2018-12-31 17:57:29 -08:00
Paul Eggert
26bed8ba10 Update copyright year to 2019
Run 'TZ=UTC0 admin/update-copyright $(git ls-files)'.
2019-01-01 01:01:13 +00:00
Eli Zaretskii
4f0e54223a Improve doc strings generated by 'easy-mmode-define-navigation'
* lisp/emacs-lisp/easy-mmode.el
(easy-mmode-define-navigation): Include the documentation of
prefix argument in the generated doc string.
2018-11-09 11:22:46 +02:00
Michael Heerdegen
049bd5d267 Don't quote self-quoting pcase patterns
* admin/bzrmerge.el:
* lisp/char-fold.el:
* lisp/dired.el:
* lisp/emacs-lisp/derived.el:
* lisp/emacs-lisp/easy-mmode.el:
* lisp/emacs-lisp/easymenu.el:
* lisp/emacs-lisp/eieio-core.el:
* lisp/emacs-lisp/package.el:
* lisp/emacs-lisp/smie.el:
* lisp/faces.el:
* lisp/filesets.el:
* lisp/progmodes/modula2.el:
* lisp/progmodes/octave.el:
* lisp/progmodes/opascal.el:
* lisp/progmodes/perl-mode.el:
* lisp/progmodes/prolog.el:
* lisp/progmodes/ruby-mode.el:
* lisp/progmodes/sh-script.el:
* lisp/server.el:
* lisp/subr.el:
* lisp/textmodes/css-mode.el:
* test/lisp/emacs-lisp/pcase-tests.el: Don't quote self-quoting
'pcase' patterns.
2018-10-30 16:17:45 +01:00
Glenn Morris
cda7e1850f Merge from origin/emacs-26
17ebb6e (origin/emacs-26) Use consistent function names in thread-tes...
1c86229 Fix format error in Faccept_process_output
b38b91a Lessen stack consumption in recursive read1
3eb4603 Match w32 paths in grep sans --null hits (Bug#32051)
5cc7c4b Fix previous make-network-process change
d6a1b69 Another documentation improvement in flyspell.el
9b49a8e Improve documentation of Flyspell
3744fda Provide feature 'threads
ef9025f Save the server alias on reconnect (Bug#29657)
db3874b Refer to "proper lists" instead of "true lists"
35e0305 Avoid turning on the global-minor-mode recursively
51bf4e4 Fix Bug#32085
2018-07-13 09:28:15 -07:00
John Shahid
35e0305dc2 Avoid turning on the global-minor-mode recursively
* lisp/emacs-lisp/easy-mmode.el (define-globalized-minor-mode): Clear
the buffer-list inside MODE-enable-in-buffers to avoid enabling the
mode recursively.  (Bug#31793)
2018-07-10 08:13:39 -04:00
John Shahid
ee3e432300 Optionally add argument description in minor mode DOC (bug#10754)
Add a paragraph to minor mode's docstring documenting the mode's ARG
usage if the supplied docstring doesn't already contain the word "ARG".

* easy-mmode.el (easy-mmode--arg-docstring): New const.
(easy-mmode--arg-docstring): New function.
(define-minor-mode): Use them.

Remove argument documentation from all minor modes.
2018-07-01 23:34:53 -04:00
Paul Eggert
bb267f17f9 Merge from origin/emacs-26
63b04c11d5 Fix copyright years by hand
5c7dd8a783 Update copyright year to 2018
220a9ecba1 Merge from Gnulib
312c565566 Don't add empty keyboard macro to macro ring (Bug#24992)
39ca289a7a Allow customization of decoding of "man" command
f8240815ea * etc/NEWS: Add security consideration note on passphrase ...
0c78822c70 Fix subtle problem with scroll-down when scroll-margin is ...
acd289c5a4 Fix problems with indexing in User manual
b240c7846b * lisp/help.el (describe-key): Only (copy-sequence elt) wh...
e879a5444a * src/buffer.c (Frestore_buffer_modified_p): Fix bug#29846
81b1028b63 Improve documentation of 'inhibit-modification-hooks' and ...
7175496d7a Fix doc string of 'enable-recursive-minibuffers'
5b38406491 Fix documentation of delsel and of killing text

# Conflicts:
#	etc/NEWS
#	etc/refcards/ru-refcard.tex
2018-01-01 01:13:04 -08:00
Paul Eggert
5c7dd8a783 Update copyright year to 2018
Run admin/update-copyright.
2018-01-01 00:57:59 -08:00
Paul Eggert
1441eb76fd Merge from origin/emacs-26
460fe4a1bc ; Doc fixes
41adf3281e Avoid duplicate calls to xfree for the same pointer
3e7ebbe1bd Don't clobber docstrings of explicitly-defined mode hook v...
9c8fe0248b Avoid fullscreen ediff control frames by default (Bug#29026)
7d32176acc Fix the bug#24034 change (revno 9eb028f) causing infloop (...
ee493663ba Merge branch 'emacs-26' of git.savannah.gnu.org:/srv/git/e...
ca5eb0d0b7 Fix a typo in the ELisp manual
d10c9479ca Fix doc and doc-strings for minibuffer window related func...
18331d00da Fix "Args out of range" error in c-determine-limit.  Fixes...
edde35e6f8 * lisp/progmodes/perl-mode.el: Fix electric indentation wi...
056587c45f Extend mhtml submode region when in comment
4c4ad80848 Fix mthml submode lighting at end of buffer
557e252aa2 Remember more variables in mhtml-mode
336cd0a11a ; * lisp/select.el (select-enable-primary): Add missing pe...
134099bc90 ; * etc/NEWS (EUDC): Mark as not requiring documentation.
1a340274bf * etc/NEWS (EUDC): Deprecate BBDB 2.x backward compatibility.
4189d0ef7b Fix minibuffer window related docs and strings (Bug#28978)
2ebdde6e9c Add ChkTeX flymake backend for latex-mode
5b59841791 Fix doc typos
82a16c547b Fix some duplicate word typos
266888b1d7 * doc/lispref/commands.texi (Adjusting Point): Fix wording...
00c3c6d88d Avoid segfaults in 64-bit Windows builds
a8e6741066 Fix conversion of pixel coordinates to buffer position
d43b486f6c Fix doc strings in desktop.el
9102fb603e Add Index to ERT manual
68182a4710 Make manuals and NEWS consistent
451823b0e5 Don't allow (minibuffer-window-active-p nil) to return t
cc8f72ca22 Clarify obsolescence message for 'whitespace-tab'
50f711e7fa Fix some duplicate words typos
8bd9524a7c * lisp/button.el (button-activate): Fix doc typo.
0b0d91e60a * lisp/calendar/todo-mode.el (todo-toggle-mark-item): Fix ...
e6b4e5ffdf Fix some doc typos
e8636ac8cc Fix startup display on Cygwin
3926c5ad83 * src/fileio.c (Fset_default_file_modes): Fix typo in doc ...
9715317dfd * lisp/dired.el (dired-find-alternate-file): Doc fix.  (Bu...
9e442a001a Improve documentation of how faces are applied to display ...
1bda71ec3b Improve pixel-scroll-mode
196106d37d Support Certification Authority Authorization in dns-mode.el
ec08d70b4f Improve documentation of set-default-file-modes

# Conflicts:
#	etc/NEWS
2017-11-02 21:01:44 -07:00
Phil Sainty
3e7ebbe1bd Don't clobber docstrings of explicitly-defined mode hook variables
* lisp/emacs-lisp/derived.el (define-derived-mode):
* lisp/emacs-lisp/easy-mmode.el (define-minor-mode): When defining the
mode hook variable, do not clobber pre-existing docstrings.
2017-10-31 08:20:30 -04:00