Commit graph

512 commits

Author SHA1 Message Date
Lars Ingebrigtsen
a498e5f830 Get fewer false positives for :keyword and &options
* lisp/emacs-lisp/lisp-mode.el (lisp-mode--search-key): New
function to check more carefully for start of :keywords and
&options (bug#51574).
(lisp-fdefs): Use it.
2022-09-20 13:34:42 +02:00
Lars Ingebrigtsen
48b0f2606b Revert the changes to lisp-current-defun-name
* lisp/emacs-lisp/lisp-mode.el (lisp-current-defun-name): Revert
back to the old version before bug#49592.  The new approach just
doesn't work well enough -- we don't really have the data to know
that, say, `make-obsolete-variable' is about the second symbol and
not the first.
2022-08-23 12:26:24 +02:00
Lars Ingebrigtsen
90b4ee6575 Further lisp-current-defun-name tweaks
* lisp/emacs-lisp/lisp-mode.el (lisp-current-defun-name): Further
tweaks to make (autoload 'foo) work again.  Perhaps this should
all be reverted to the original version and then given a new rething.
2022-08-15 07:30:25 +02:00
Lars Ingebrigtsen
b2bf91003d Further lisp-current-defun-name tweaks
* lisp/emacs-lisp/lisp-mode.el (lisp-current-defun-name): Tweak so
that cl-defmethod and friends work again.
2022-08-09 19:21:36 +02:00
Michael Heerdegen
fe4fd160a2 Another lisp-current-defun-name tweak
* lisp/emacs-lisp/lisp-mode.el (lisp-current-defun-name): Avoid error
when edebug spec is the symbol t.
2022-08-09 04:01:29 +02:00
Lars Ingebrigtsen
909931cb9a Further lisp-current-defun-name tweaks
* lisp/emacs-lisp/lisp-mode.el (lisp-current-defun-name): Further
tweaks to finding the symbol being defined (defalias).
2022-08-08 15:53:41 +02:00
Lars Ingebrigtsen
55cc8b040b Make which-func-mode output less junk
* lisp/emacs-lisp/lisp-mode.el (lisp-current-defun-name): Use
edebug specs to find the name (if they exist), and default to
returning the top-level symbol if there isn't a define-like form
(bug#49592).
2022-08-08 14:32:33 +02:00
Lars Ingebrigtsen
8ab9102950 Fix `M-x lisp-fill-paragraph'
* lisp/emacs-lisp/lisp-mode.el (lisp-fill-paragraph): Fix filling
when called directly with `M-x lisp-fill-paragraph' instead of via
`M-q' (bug#56476).
2022-07-11 12:15:38 +02:00
Stefan Kangas
3e7f6ff4b0 Prefer defcustom :safe to putting 'safe-local-variable'
* lisp/emacs-lisp/lisp-mode.el (lisp-indent-offset)
(lisp-body-indent, emacs-lisp-docstring-fill-column):
* lisp/files.el (version-control):
* lisp/progmodes/modula2.el (m2-indent):
* lisp/progmodes/octave.el (octave-block-offset):
* lisp/progmodes/sh-script.el (sh-basic-offset):
* lisp/progmodes/tcl.el (tcl-indent-level)
(tcl-continued-indent-level):
* lisp/simple.el (fill-prefix):
* lisp/textmodes/fill.el (colon-double-space):
* lisp/textmodes/paragraphs.el (paragraph-start)
(paragraph-separate, sentence-end-double-space)
(sentence-end-without-period, sentence-end-without-space)
(sentence-end, sentence-end-base, page-delimiter)
(paragraph-ignore-fill-prefix):
* lisp/textmodes/tex-mode.el (tex-fontify-script):
* lisp/vc/add-log.el (add-log-dont-create-changelog-file):
* lisp/vc/vc-hooks.el (vc-follow-symlinks): Prefer defcustom :safe to
putting 'safe-local-variable'.
2022-07-06 20:50:42 +02:00
Stefan Kangas
162c6c12f9 Prefer defvar-keymap in emacs-lisp/*.el
* lisp/emacs-lisp/backtrace.el (backtrace-mode-map):
* lisp/emacs-lisp/bytecomp.el (emacs-lisp-compilation-mode-map):
* lisp/emacs-lisp/checkdoc.el (checkdoc-minor-mode-map):
* lisp/emacs-lisp/crm.el (crm-local-completion-map)
(crm-local-must-match-map):
* lisp/emacs-lisp/debug.el (debugger-mode-map):
* lisp/emacs-lisp/edebug.el (edebug-mode-map, edebug-global-map)
(edebug-eval-mode-map):
* lisp/emacs-lisp/eieio-custom.el (eieio-custom-mode-map):
* lisp/emacs-lisp/elp.el (elp-results-symname-map):
* lisp/emacs-lisp/lisp-mode.el (lisp-mode-shared-map):
* lisp/emacs-lisp/re-builder.el (reb-mode-map)
(reb-lisp-mode-map, reb-subexp-mode-map):
* lisp/emacs-lisp/tabulated-list.el (tabulated-list-mode-map)
(tabulated-list-sort-button-map):
* lisp/emacs-lisp/timer-list.el (timer-list-mode-map):
2022-07-04 22:15:51 +02:00
Mattias Engdegård
cfc754a67c ; remove regexp ambiguity 2022-07-04 15:55:35 +02:00
Mattias Engdegård
1268902db1 Remove some useless eval-when-compile
* lisp/cedet/semantic/java.el (semantic-java-number-regexp):
* lisp/cedet/semantic/lex.el (semantic-lex-number-expression):
* lisp/emacs-lisp/cl-indent.el (common-lisp-indent-function-1):
* lisp/emacs-lisp/lisp-mode.el (lisp-imenu-generic-expression)
(lisp--el-match-keyword, lisp-string-in-doc-position-p):
* lisp/emacs-lisp/shorthands.el (shorthands-font-lock-shorthands):
* lisp/net/socks.el (socks-send-command):
* lisp/progmodes/meta-mode.el (meta-font-lock-keywords):
* lisp/shell.el (shell--parse-pcomplete-arguments):
* lisp/textmodes/sgml-mode.el (sgml-mode):
* lisp/textmodes/tex-mode.el (tex--guess-mode)
(tex-common-initialization, tex-input-files-re):
* lisp/textmodes/tildify.el (tildify-mode):
* lisp/xdg.el (xdg-line-regexp):
Eliminate `eval-when-compile` when the argument would be evaluated by
the compiler anyway.
2022-07-04 14:56:11 +02:00
Mattias Engdegård
544361d37f Replace lisp-mode-symbol-regexp with (rx lisp-mode-symbol)
This is shorter, simplifies use inside rx expressions, and removes
need for eval-when-compile elsewhere (for later exploitation).

* lisp/emacs-lisp/lisp-mode.el (lisp-mode-symbol): New rx-define.
(lisp-mode-symbol-regexp): Redefine using lisp-mode-symbol.
(lisp-imenu-generic-expression, lisp--el-match-keyword)
(lisp-fdefs, lisp-string-in-doc-position-p):
* lisp/emacs-lisp/checkdoc.el (checkdoc--error-bad-format-p):
* lisp/emacs-lisp/shorthands.el (shorthands-font-lock-shorthands):
Use lisp-mode-symbol instead of lisp-mode-symbol-regexp.
2022-07-04 14:56:11 +02:00
Stefan Kangas
ae3416d694 Simplify lisp-el-font-lock-keywords-2 definition slightly
* lisp/emacs-lisp/lisp-mode.el (lisp-el-font-lock-keywords-2):
Simplify slightly.
2022-07-03 23:31:32 +02:00
Stefan Kangas
b000bd47a6 Font lock \\<> and \\{} command substitutions in docstrings
* lisp/emacs-lisp/lisp-mode.el (lisp-el-font-lock-keywords-2):
Support \\<> and \\{} command substitutions.
2022-07-03 23:31:31 +02:00
Stefan Kangas
3b66c23325 Font lock \\`' command substitutions in docstrings
* lisp/emacs-lisp/lisp-mode.el (lisp-el-font-lock-keywords-2):
Support \\`' command substitutions.
2022-07-02 05:35:58 +02:00
Lars Ingebrigtsen
8f5d9d0abd Fix a recent Lisp mode filling test failure
* lisp/emacs-lisp/lisp-mode.el (lisp-fill-paragraph): Restore the
"fill first line separately" logic.
2022-06-26 16:31:43 +02:00
Lars Ingebrigtsen
040c03cae2 Make `M-q' work on the first line of a multi-line string again
* lisp/emacs-lisp/lisp-mode.el (lisp-fill-paragraph): Exclude the
quote marks from the region so that filling works (bug#56197).
2022-06-25 14:58:17 +02:00
Lars Ingebrigtsen
a418730a1b Fix warnings introduced by the lisp-mode-autoload-regexp change
* lisp/emacs-lisp/lisp-mode.el (lisp-fdefs): The package name bit
in ###;;;foo-autoload may be missing, so do a lax match (bug#55784).
2022-06-04 13:50:07 +02:00
Lars Ingebrigtsen
f0189819d8 Add a face to \\= doc string escapes
* lisp/emacs-lisp/lisp-mode.el (lisp-fdefs): Add a face to \\= doc
string escapes (bug#55783).
2022-06-04 13:43:58 +02:00
Lars Ingebrigtsen
1d4e903417 Speed up generation of loaddefs files
* doc/lispref/loading.texi (Autoload, Autoload by Prefix): Refer
to loaddefs-generate instead of update-file-autoloads.

* lisp/Makefile.in (LOADDEFS): Remove, because all the loaddefs
files are created in one go now.
(COMPILE_FIRST): Add loaddefs-gen/radix-tree, and drop autoload.
($(lisp)/loaddefs.el): Use loaddefs-gen.
(MH_E_DIR, $(TRAMP_DIR)/tramp-loaddefs.el)
($(MH_E_DIR)/mh-loaddefs.el, $(CAL_DIR)/cal-loaddefs.el)
($(CAL_DIR)/diary-loaddefs.el, $(CAL_DIR)/hol-loaddefs.el): Remove.

* lisp/generic-x.el: Inhibit computing prefixes, because the
namespace here is all wonky.

* lisp/w32-fns.el (w32-batch-update-autoloads): Removed -- unused
function.

* lisp/calendar/holidays.el ("holiday-loaddefs"): Renamed from
hol-loaddefs to have a more regular name.

* lisp/cedet/ede/proj-elisp.el (ede-emacs-cedet-autogen-compiler):
Refer to loaddefs-gen instead of autoload.

* lisp/emacs-lisp/autoload.el (make-autoload, autoload-rubric)
(autoload-insert-section-header): Made into aliases of
loaddefs-gen functions.
(autoload--make-defs-autoload): Ditto.
(autoload-ignored-definitions, autoload-compute-prefixes): Moved
to loaddefs-gen.

* lisp/emacs-lisp/lisp-mode.el (lisp-mode-autoload-regexp): New
constant.
(lisp-fdefs, lisp-mode-variables, lisp-outline-level): Use it to
recognize all ;;;###autoload forms.

* lisp/emacs-lisp/loaddefs-gen.el: New file.

* lisp/emacs-lisp/package.el: Use loaddefs-generate instead of
make-directory-autoloads.

* test/lisp/vc/vc-bzr-tests.el (vc-bzr-test-faulty-bzr-autoloads):
Use loaddefs instead of autoloads.
2022-05-31 18:08:33 +02:00
Lars Ingebrigtsen
de9dfb1939 Fix font-locking of (defun foo (function ...))
* lisp/emacs-lisp/lisp-mode.el (lisp--el-funcall-position-p):
Don't colorize the `function' in (defun foo (function ...)) as a
special form (bug#37074).
2022-05-20 03:46:35 +02:00
Lars Ingebrigtsen
4c4eda4c31 Make imenu find defalias entries
* lisp/emacs-lisp/lisp-mode.el (lisp-imenu-generic-expression):
Also find defalias (bug#7855).
2022-05-10 04:41:43 +02:00
Lars Ingebrigtsen
88a04ea985 Tweak how `M-q' in emacs-lisp-mode works
* lisp/emacs-lisp/lisp-mode.el (lisp-fill-paragraph): Only fill as
strings inside strings (bug#31656).
(lisp--fill-line-simple): New function to do simple sexp-based
filling.
2022-04-13 05:07:47 +02:00
Eli Zaretskii
dcd76bd48d Merge from origin/emacs-28
836be7a112 ; * etc/refcards/ru-refcard.tex: Update Copyright year.
86cbc6ee4a * lisp/net/tramp-sh.el: Adapt copyright year
ebe8772f65 ; Minor fixes related to copyright years
23c1ee6989 ; * test/manual/etags/ETAGS.good_N: Adjust to copyright ye...
8d3fc7ec89 * src/xfaces.c (face_for_font): Make 'hash' be uintptr_t.
19dcb237b5 ; Add 2022 to copyright years.

# Conflicts:
#	etc/NEWS
#	etc/refcards/ru-refcard.tex
#	lib/cdefs.h
#	lisp/erc/erc-dcc.el
#	lisp/erc/erc-imenu.el
#	lisp/erc/erc-replace.el
#	lisp/image-dired.el
#	lisp/progmodes/xref.el
#	m4/alloca.m4
#	m4/byteswap.m4
#	m4/errno_h.m4
#	m4/getopt.m4
#	m4/gnulib-common.m4
#	m4/inttypes.m4
#	m4/stddef_h.m4
#	m4/stdint.m4
#	m4/sys_socket_h.m4
2022-01-01 07:03:03 -05:00
Eli Zaretskii
19dcb237b5 ; Add 2022 to copyright years. 2022-01-01 02:45:51 -05:00
Lars Ingebrigtsen
f1606047c4 Indent `closure' forms better
* lisp/emacs-lisp/lisp-mode.el (closure): Indent `closure' forms
better (bug#52063).
2021-11-25 14:41:45 +01:00
akater
3fd0e7fba6 ; * lisp/emacs-lisp/lisp-mode.el: Restore one check in flet handling
* lisp/emacs-lisp/lisp-mode.el (lisp--local-defform-body-p):
Do check backward-up-list executing without errors (bug#9622).
2021-11-09 04:26:05 +01:00
akater
ca9fb109f7 lisp/emacs-lisp/lisp-mode.el: Fix parser state corruption.
* lisp/emacs-lisp/lisp-mode.el (lisp--local-defform-body-p): Preserve
the point.
* test/lisp/progmodes/elisp-mode-resources/flet.erts: Add corresponding
test example (bug#9622).
2021-11-08 07:38:41 +01:00
akater
0aa9f478e9 Indent cl-flet-like forms correctly in incomplete expressions
* lisp/emacs-lisp/lisp-mode.el
(lisp--local-defform-body-p): Support incomplete sexps

* test/lisp/progmodes/elisp-mode-resources/flet.erts:
Add tests for incomplete sexps (bug#9622).
2021-10-28 23:53:50 +02:00
Glenn Morris
4cf06bb751 Merge from origin/emacs-28
b0d64be0bc (origin/emacs-28) Improve some NEWS entries
7fde84e881 Improve documentation of syntax-ppss-context slightly
5ecbed01b2 ; * test/lisp/mh-e/mh-utils-tests.el: Update macro declara...
168665da59 Move some xwidget entries
efde024361 time-stamp-tests: improvements to test macros
06c944cff1 Fix rfc6068-parse-mailto-url autoload
9b6b5e37ef Regexp-quote github domains in bug-reference
1f6cdeb12c Ensure valid end/beginning lines in message-mark-inserted-...
9b46150ab0 * etc/NEWS: Improve 'repeat-mode' entry.
9c37b812da ; * lisp/repeat.el (repeat-mode): Fix docstring typo.
caf87d80fa * lisp/repeat.el (repeat-keep-prefix): Expand description.
24083c8d13 * lisp/net/eww.el (eww-retrieve-command): Add :tag.
cf7d8fb1d7 Add description of cards to etc/refcards/README
d2849cc645 Fix 'calculate-lisp-indent' when "[" starts containing sex...
2a0a368ddc Fix typo in doc/emacs/anti.texi
9529e1d2fb Update doc of Edebug specification for macros
5bc522b4f4 ; * lisp/simple.el (kill-region): A better fix for bug#51320.
ee6bdd6eef Fix non-interactive behavior of 'kill-region'
2b7655ca0e ; More accurate doc string for 'tab-bar-format'
2841e26744 * test/lisp/dabbrev-tests.el: Use 'kbd' for readable keys.
1cdb4d2077 * lisp/menu-bar.el (menu-bar-keymap): Add optional arg KEY...

# Conflicts:
#	etc/NEWS
#	lisp/progmodes/bug-reference.el
2021-10-22 09:39:39 -07:00
Martin Rudalics
d2849cc645 Fix 'calculate-lisp-indent' when "[" starts containing sexp (Bug#51312)
* lisp/emacs-lisp/lisp-mode.el (calculate-lisp-indent): Handle
arbitrary paren syntax after skipping whitespace backwards within
containing sexp (Bug#51312).
2021-10-22 10:16:17 +02:00
Lars Ingebrigtsen
7e1329e7ed Add indentation rules for DEFUN's def* functions 2021-10-18 10:44:28 +02:00
Lars Ingebrigtsen
32df203423 Remove the "def" indentation heuristic
* lisp/emacs-lisp/lisp-mode.el (lisp-indent-function): Don't
indent function calls with names that that start with "def"
specially (bug#43329).
2021-10-18 10:00:20 +02:00
Lars Ingebrigtsen
ef9fa3682a Fontify :doc keywords as documentation
* lisp/emacs-lisp/lisp-mode.el (lisp-string-after-doc-keyword-p):
Extend to :doc, too (bug#51230).
2021-10-18 09:44:24 +02:00
Glenn Morris
2dc88a27a4 Merge from origin/emacs-28
63abe976ce (origin/emacs-28) Document minibuffer-default-prompt-forma...
b5afbedc90 Backward compatibility option for 'nobreak-char-display'
ea1b728a06 ; * lisp/dired.el: Fix typo.
984eafeb98 Unbreak the build after Gnulib update
5946370cd1 Check, whether an FUSE mount has been broken in Tramp
90575a6c0c Disable 'nobreak-char-display' in Eldoc buffers
570e2c9a17 Fix small error in comint-send-input
fd7bb31412 Update documentation of search-whitespace-regexp
1f4ced47a1 Fix cc-compat.el syntax error
b431f54c1b Mention `seq-uniq' in `delete-dups' documentation
0a7bab689c ; Minor stylistic fixes found by checkdoc
e2861e2d08 ; * etc/NEWS: Fix typo.
1a65d49931 Port recent Gnulib changes to MS-Windows
68a256c892 Update from Gnulib
63cb65dcce * Fix mh tests for native comp builds (bug#50975)
e606cc6f40 * Fix `batch-native-compile' not to spawn a subprocess
894dfe70da Fix native-compilation build from tarball on Cygwin
2ce5e08058 Remove U+FE0F from script-representative-chars

# Conflicts:
#	etc/NEWS
2021-10-05 07:50:22 -07:00
Lars Ingebrigtsen
4103123806 Change the call convention for `defvar-keymap'
* doc/lispref/keymaps.texi (Changing Key Bindings): Adjust
documentation.

* lisp/simple.el (special-mode-map):
* lisp/net/shr.el (shr-map):
* lisp/net/eww.el (eww-link-keymap):
(eww-mode-map):
(eww-submit-map):
(eww-textarea-map):
(eww-bookmark-mode-map):
(eww-history-mode-map):
(eww-buffers-mode-map):
* lisp/gnus/message.el (message-mode-map):
* lisp/gnus/gnus-html.el (gnus-html-image-map):
* lisp/gnus/gnus-eform.el (gnus-edit-form-mode-map):
* lisp/gnus/gnus-dired.el (gnus-dired-mode-map):
* lisp/gnus/gnus-bookmark.el (gnus-bookmark-bmenu-mode-map):
Adjust usage of `defvar-keymap'.

* lisp/subr.el (define-keymap, define-keymap--define): Change how
these functions call each other.
(defvar-keymap): Change interface to be more like `define-keymap'.

* lisp/emacs-lisp/lisp-mode.el (lisp-indent--defvar-keymap): Remove.
(lisp-indent-function): Don't use it.
2021-10-05 10:34:37 +02:00
Stefan Kangas
0a7bab689c ; Minor stylistic fixes found by checkdoc 2021-10-05 02:06:57 +02:00
Lars Ingebrigtsen
192f9357f2 Add 'define-keymap' and 'defvar-keymap'
* doc/lispref/keymaps.texi (Changing Key Bindings): Document
define-keymap and defvar-keymap.

* lisp/subr.el (define-keymap): New function.
(define-keymap--define): New function.
(defvar-keymap): New macro.

* lisp/emacs-lisp/lisp-mode.el (lisp-indent--defvar-keymap): New
function.
(lisp-indent-function): Use it to indent defvar-keymap.
2021-10-04 10:15:11 +02:00
akater
5988d6fa26 Restore the flet indentation fixes
* lisp/emacs-lisp/lisp-mode.el (lisp--local-defform-body-p): New
function.
(lisp-indent-function): Use it to fix cl-flet indentation.
2021-10-01 13:25:42 +02:00
Mattias Engdegård
41723a329e Revert "Indent bodies of local function definitions properly in elisp-mode"
This reverts commit 38037e04cb.
2021-09-30 16:52:16 +02:00
Mattias Engdegård
be493ea67a Revert "Fix regressions in cl-flet indentation"
This reverts commit c42af5aee7.
2021-09-30 16:52:16 +02:00
akater
c42af5aee7 Fix regressions in cl-flet indentation
* lisp/emacs-lisp/lisp-mode.el (lisp--local-defform-body-p):
Rename (from -p-less form) and fix indentation regression
introduced by 38037e04cb
(bug#9622).  Also add cl-macrolet cl-flet* cl-symbol-macrolet.
2021-09-30 08:33:14 +02:00
akater
38037e04cb Indent bodies of local function definitions properly in elisp-mode
* lisp/emacs-lisp/lisp-mode.el (lisp-indent-function): Check for
local defforms (`cl-flet' and `cl-labels').
(lisp--local-defform-body): New auxiliary function (bug#9622).
2021-09-25 03:34:37 +02:00
Stefan Kangas
dd1220b969 ; More stylistic docfixes in emacs-lisp/*.el found by checkdoc 2021-09-18 13:14:50 +02:00
Eli Zaretskii
a38675ca88 Support '...' quoting in Lisp files
* lisp/emacs-lisp/lisp-mode.el (lisp-el-font-lock-keywords-2):
Support quoting 'like this'.
2021-09-16 17:10:49 +03:00
Stefan Kangas
25ebb9374b ; More minor docfixes found by checkdoc 2021-09-14 07:57:14 +02:00
Eli Zaretskii
ff4de1bd88 Fix quoting style in Lisp comments
* lisp/textmodes/rst.el:
* lisp/progmodes/elisp-mode.el (elisp--xref-find-definitions):
* lisp/org/org.el:
* lisp/org/org-list.el (org-list-to-generic):
* lisp/org/org-compat.el:
* lisp/hexl.el (hexl-ascii-region):
* lisp/emacs-lisp/lisp-mode.el:
* lisp/calendar/calendar.el: In comments, quote 'like this'.
2021-09-12 19:51:06 +03:00
Stefan Kangas
fc4b956c7c ; Fix symbol quoting typos 2021-09-12 18:36:49 +02:00
João Távora
1439e9bfad Adjust docstring of lisp-mode (bug#49278)
* lisp/emacs-lisp/lisp-mode.el (lisp-mode): Mention that this mode is
primarily for Common Lisp.
2021-06-30 17:00:20 +01:00