Commit graph

7939 commits

Author SHA1 Message Date
Lars Ingebrigtsen
82d0550648 Remove messaging in pp-display-expression.
* lisp/emacs-lisp/pp.el (pp-display-expression): Remove confusing
message -- we don't usually say that we've popped up a new buffer when
we do so.
2021-11-06 02:20:06 +01:00
Stefan Kangas
1eaee319ea Add "N.B." abbreviation to checkdoc
* lisp/emacs-lisp/checkdoc.el (checkdoc-in-abbreviation-p): Add
abbreviation "N.B.".
2021-11-05 22:31:42 +01:00
Stefan Kangas
49a6b26cf7 Don't hardcode "Commentary" section in checkdoc
* lisp/emacs-lisp/checkdoc.el
(checkdoc-commentary-header-string): New defvar.
(checkdoc-file-comments-engine): Insert value of above new
variable instead of hardcoding what is inserted for the
"Commentary" section.
2021-11-05 22:31:17 +01:00
Lars Ingebrigtsen
c1865384d7 Allow 'pp' to limit the line widths
* lisp/emacs-lisp/pp.el (pp-max-width, pp-use-max-width): New user
options (bug#11934).
(pp-to-string): Use it.
(pp--insert-lisp): Tweak whether to use standard-output or not.
(pp--max-width): New function.
2021-11-05 15:27:08 +01:00
Lars Ingebrigtsen
a78ac0c5df Try harder to keep lines short in pp-emacs-lisp-code
* lisp/emacs-lisp/pp.el (pp--insert): Try harder to keep lines short.
2021-11-04 23:32:51 +01:00
Lars Ingebrigtsen
4cf7af5a2a Tweak multi-line expressions in pp--format-function
* lisp/emacs-lisp/pp.el (pp--format-function): Fix up multi-line
expressions.
2021-11-04 23:16:47 +01:00
Lars Ingebrigtsen
cb9f3e1158 Fix up some list folding in pp-emacs-lisp-code
* lisp/emacs-lisp/pp.el (pp--insert-lisp, pp--format-list)
(pp--insert): Touch up list folding.
2021-11-04 22:31:15 +01:00
Lars Ingebrigtsen
fb1267d90a Indent lambdas/closures better
* lisp/emacs-lisp/pp.el (pp--format-function): Indent lambdas and
closures better.
2021-11-04 22:07:48 +01:00
Lars Ingebrigtsen
292f50d27b Make lambda/closure help buttons format as Emacs Lisp
* lisp/help.el (help--describe-command): Format lambda/closures as
Emacs Lisp.

* lisp/emacs-lisp/pp.el (pp-display-expression): Allow formatting
as Emacs Lisp.
2021-11-04 21:52:56 +01:00
Lars Ingebrigtsen
6cf86ed4c1 Add new basic Emacs Lisp code formatting function
* lisp/emacs-lisp/pp.el (pp-emacs-lisp-code): New interface function.
(pp): Mention it.
(pp--insert-lisp, pp--format-vector, pp--format-list)
(pp--format-function, pp--format-definition, pp--insert-binding)
(pp--insert, pp--indent-buffer): New helper functions.
2021-11-04 21:44:53 +01:00
Lars Ingebrigtsen
1c3e45396e Rename button-buttonize to buttonize
* lisp/help.el (help--describe-command):
* lisp/emacs-lisp/memory-report.el (memory-report--buffers):
* lisp/button.el (button-buttonize):
* doc/lispref/display.texi (Making Buttons): Rename
button-buttonize to just buttonize and adjust callers.
2021-11-04 18:14:29 +01:00
Mattias Engdegård
493fde95be Optimise (cond) => nil at source level
* lisp/emacs-lisp/byte-opt.el (byte-optimize-cond):
Optimise clause-free `cond`, which can arise from earlier
transformations.  This enables further optimisations.
* test/lisp/emacs-lisp/bytecomp-tests.el (bytecomp-tests--test-cases):
Add test cases.
2021-11-02 22:46:20 +01:00
Stefan Kangas
2612488c36 Support inserting images in tabulated-list-mode columns
* lisp/emacs-lisp/tabulated-list.el (tabulated-list-print-col):
Support using an image descriptor to insert an image in a column.
(tabulated-list-entries):
* doc/lispref/modes.texi (Tabulated List Mode): Update documentation
to reflect above change.
2021-11-02 17:44:57 +01:00
Lars Ingebrigtsen
cd73ec72a6 Make lambdas/closures/byte code in `C-h b' clickable
* lisp/help.el (help--describe-command): Add links for
lambdas/closures/byte code (bug#24235).

* lisp/emacs-lisp/pp.el (pp-display-expression): Autoload.
2021-11-02 16:20:19 +01:00
Gregory Heytings
daea9b3b44 Read mailcaps again only when necessary
* doc/lispref/files.texi (File Attributes): Document it.

* lisp/files.el (file-has-changed-p): New function.
(file-has-changed-p--hash-table): Internal variable used by the
new function (bug#51523).
* lisp/emacs-lisp/shortdoc.el (file): Mention it.

* lisp/net/mailcap.el (mailcap-parse-mailcaps): Read mailcaps again
only when at least one of the mailcap files has changed.  Fixes
bug#51523.
2021-11-01 14:51:57 +01:00
Stefan Monnier
d553e603f4 eieio-core.el: Make slot-value work on defstructs
Adjust the values in EIEIO's index-tables so they are compatible with those
of defstructs.

* lisp/emacs-lisp/eieio-core.el (eieio--slot-name-index): Don't add the
`eieio--object-num-slots` offset.
(eieio-defclass-internal): Add the `eieio--object-num-slots` offset
here instead.
(eieio-oref): Allow its use on `cl-structure-object`.

* lisp/emacs-lisp/eieio.el (eieio-pcase-slot-index-from-index-table):
Don't need to add the `eieio--object-num-slots` offset.

* doc/misc/eieio.texi (Accessing Slots, Accessing Slots):
Mention the use on structs.

* test/lisp/emacs-lisp/eieio-tests/eieio-tests.el
(eieio-test-defstruct-slot-value): New test.
2021-10-31 10:58:43 -04:00
Stefan Kangas
54b8ec4e6f Remove workaround for fixed Bug#6581 from ert
* lisp/emacs-lisp/ert.el (ert-equal-including-properties): Make
into obsolete function alias for 'equal-including-properties'.
* test/src/editfns-tests.el (format-properties):
* test/lisp/emacs-lisp/ert-x-tests.el (ert-propertized-string)
(ert-test-run-tests-interactively-2): Don't use above obsolete
name.

(ert--explain-equal-including-properties-rec): New function.
(ert--explain-equal-including-properties): Use as an explainer for
'equal-including-properties' now that Bug#6581 is fixed.

* test/lisp/emacs-lisp/ert-tests.el
(ert-test-explain-equal-string-properties): Expand test.
(ert-test-equal-including-properties): Merge test into above
expanded test.
2021-10-31 03:02:32 +01:00
Stefan Kangas
8227d1273e Fix bug with string values in equal-including-properties
* src/intervals.c (intervals_equal_1): Factor out from
intervals_equal.  Optionally use Fequal for comparison of string
values in property lists.
(intervals_equal): Update for the above.
(compare_string_intervals): Use the above optional Fequal comparison
to fix a bug where 'equal-including-properties' compared strings with
eq, instead of equal.  (Bug#6581)
* test/src/fns-tests.el (fns-tests-equal-including-properties)
(fns-tests-equal-including-properties/string-prop-vals): New tests.

* test/lisp/emacs-lisp/ert-tests.el
(ert-test-equal-including-properties): Remove parts testing
'equal-including-properties'.
* lisp/emacs-lisp/ert.el (ert-equal-including-properties): Add
FIXME that this should be removed.
2021-10-31 03:02:32 +01:00
Lars Ingebrigtsen
c23cb2861e Add new function string-glyph-split
* doc/lispref/strings.texi (Creating Strings): Document it.
* lisp/emacs-lisp/shortdoc.el (string): Mention it.

* lisp/emacs-lisp/subr-x.el (string-glyph-split): New function.
2021-10-30 15:22:36 +02:00
Eli Zaretskii
c30f95078c Merge from origin/emacs-28
20ebd91a73 Improve documentation of string truncation APIs
3f998a3fc8 * lisp/textmodes/css-mode.el: Fix typo.  (Bug#51488)
2021-10-30 04:07:09 -04:00
Eli Zaretskii
20ebd91a73 Improve documentation of string truncation APIs
* doc/lispref/display.texi (Size of Displayed Text):
* lisp/international/mule-util.el (truncate-string-to-width):
Document caveats of using 'truncate-string-to-width' when
character composition is involved.

* lisp/emacs-lisp/subr-x.el (string-limit):
* doc/lispref/strings.texi (Creating Strings): Improve the
documentation of 'string-limit'.
2021-10-30 10:26:38 +03:00
Glenn Morris
faa2a990c9 Merge from origin/emacs-28
52e7049b58 * lisp/loadup.el: Unbreak build.
91e7df281e Move lisp/shorthands.el to lisp/emacs-lisp/shorthands.el
00103154e0 Some Tramp changes, mainly in tramp-tests.el
2021-10-29 09:20:05 -07:00
Lars Ingebrigtsen
91e7df281e Move lisp/shorthands.el to lisp/emacs-lisp/shorthands.el 2021-10-29 14:37:08 +02: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
Stefan Monnier
c22b735f0c (string-pixel-width): Rewrite to avoid side effects
* src/xdisp.c (Fwindow_text_pixel_size): Allow `window` to be a buffer.
* lisp/emacs-lisp/subr-x.el (string-pixel-width): Simplify accordingly.
2021-10-27 14:03:43 -04:00
Lars Ingebrigtsen
7c6f7dc99b Simplify string-pixel-width
* lisp/emacs-lisp/subr-x.el (string-pixel-width): Simplify --
save-window-excursion saves dedication status (and the code was
buggy).
2021-10-27 16:50:40 +02:00
Lars Ingebrigtsen
713e19a60a Fix parsing of erts files
* lisp/emacs-lisp/ert.el (ert-test-erts-file): Fix progress
through a test file (bug#51409).
2021-10-27 16:13:30 +02:00
Lars Ingebrigtsen
5b61f2defe Harden ert-resource-directory against errors
* lisp/emacs-lisp/ert-x.el (ert-resource-directory): Be more
resilient -- don't bug out if called from a file that's not
visiting a directory.
2021-10-27 16:04:31 +02:00
Lars Ingebrigtsen
03366de394 Add new function 'string-pixel-width'
* doc/lispref/display.texi (Size of Displayed Text): Mention it.
* lisp/emacs-lisp/shortdoc.el (string): Mention it.

* lisp/emacs-lisp/subr-x.el (string-pixel-width): New function.
2021-10-27 15:41:32 +02:00
Stefan Kangas
241574375d Add links to commentary reached with finder-list-keywords
* lisp/finder.el (finder-goto-xref): Move from here...
* lisp/emacs-lisp/package.el (package--finder-goto-xref): ...to
here.  Make the old name into an obsolete function alias.
(package--finder-xref): New button type.
(package--describe-add-library-links): Factor out new function...
* lisp/finder.el (finder-commentary): ...from here.
(describe-package-1): Call above new function.  This fixes an
issue where commentaries reached via 'finder-list-keywords' did
not have links.  (Bug#10814)
2021-10-23 05:28:32 +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
5c996471ba Error out on invalid `define-keymap' keywords
* lisp/subr.el (define-keymap--define): Error out on invalid
keywords (bug#51268).

* lisp/emacs-lisp/byte-opt.el (byte-optimize-define-keymap): Check
keywords at compile time.
* lisp/vc/cvs-status.el (cvs-status-mode-map): Fix keyword.
2021-10-19 04:50:59 +02:00
Lars Ingebrigtsen
7e1329e7ed Add indentation rules for DEFUN's def* functions 2021-10-18 10:44:28 +02:00
Lars Ingebrigtsen
8d086592c3 Update elp-not-profilable
* lisp/emacs-lisp/elp.el (elp-not-profilable): Update list of
denied functions (bug#40335).
2021-10-18 10:40:08 +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
Daniel Martín
9f505c476e New option show-paren-context-when-offscreen
* lisp/simple.el (blink-paren-open-paren-line-string): Extract
functionality that shows the open paren line in the echo area into its
own function, to reuse it from paren.el.
(blink-matching-open): Use blink-paren-open-paren-line-string.
* lisp/paren.el (show-paren-context-when-offscreen): New option
show-paren-context-when-offscreen.
(show-paren-function): Implement it using
blink-paren-open-paren-line-string.
* lisp/emacs-lisp/eldoc.el (eldoc-display-message-no-interference-p):
Make sure the feature works well with eldoc.
* test/lisp/paren-tests.el (paren-tests-open-paren-line): Test
blink-paren-open-paren-line-string.
* doc/emacs/programs.texi (Matching): Update the documentation.
* etc/NEWS: And announce the new feature.
2021-10-18 09:26:44 +02:00
Lars Ingebrigtsen
5029684358 Reinstate defvar-keymap expansion
* lisp/emacs-lisp/byte-opt.el
(byte-optimize-define-keymap--define): Make more robust.
2021-10-17 21:29:59 +02:00
Lars Ingebrigtsen
94fe416c95 Back out `define-keymap' optimization -- it leads to a build error 2021-10-17 21:06:26 +02:00
Lars Ingebrigtsen
e36d3fc452 Support a new ["..."] key binding syntax
* doc/lispref/keymaps.texi (Key Sequences):
(Changing Key Bindings): Document the various key syntaxes.

* lisp/emacs-lisp/byte-opt.el (byte-optimize-define-key)
(byte-optimize-define-keymap)
(byte-optimize-define-keymap--define): New functions to check and
expand ["..."] syntax at compile time.

* src/keymap.c (Fdefine_key): Understand the ["..."] syntax.
(syms_of_keymap): Define `kbd' symbols.
2021-10-17 20:51:31 +02:00
Glenn Morris
536968304b Merge from origin/emacs-28
e8488808df Avoid aborts when a thread is signaled while "waiting for ...
21397cce51 Improve documentation string for 'compilation-error-regexp...
2971a6890f * lisp/emacs-lisp/comp.el (comp-trampoline-compile): Fix t...
e842d7f29a Fix removal of fringe indication of bookmarks
b5a0eda978 Prefer "graphical displays" to "X terminals" in documentation
4ad0fc0dd0 Precise documentation of file-notify-add-watch
f5b8df14c6 Fixes to account for windows' tab lines
ced72b6e4c * Fix `native-compile-target-directory' effectiveness on t...
502788bc3d Add missing single quotes in the Emacs manual
1af45ad04e ; * lisp/emacs-lisp/comp.el (comp-trampoline-compile): Fix...
12654b7423 * lisp/menu-bar.el (yank-menu-length): Fix docstring (bug#...

# Conflicts:
#	lisp/gnus/gnus-undo.el
#	lisp/menu-bar.el
2021-10-16 09:18:37 -07:00
Andrea Corallo
2971a6890f * lisp/emacs-lisp/comp.el (comp-trampoline-compile): Fix target dir. 2021-10-16 10:56:50 +02:00
Andrea Corallo
ced72b6e4c * Fix `native-compile-target-directory' effectiveness on trampolines
* lisp/emacs-lisp/comp.el (comp-trampoline-compile): Fix
`native-compile-target-directory' effectiveness on trampoline
compilation.
2021-10-15 09:32:20 +02:00
Andrea Corallo
1af45ad04e ; * lisp/emacs-lisp/comp.el (comp-trampoline-compile): Fix comment. 2021-10-15 09:18:54 +02:00
Lars Ingebrigtsen
3b3211c023 Mark def* macros for indentation
* lisp/widget.el (define-widget-keywords):
* lisp/vc/pcvs.el (defun-cvs-mode):
* lisp/subr.el (defvar-local):
(defvar-keymap):
* lisp/skeleton.el (define-skeleton):
* lisp/simple.el (define-alternatives):
* lisp/progmodes/gud.el (gdb-script-mode):
* lisp/progmodes/gdb-mi.el (def-gdb-preempt-display-buffer):
(def-gdb-auto-update-trigger):
(def-gdb-auto-update-handler):
(def-gdb-trigger-and-handler):
(def-gdb-thread-buffer-command):
(def-gdb-thread-buffer-simple-command):
(def-gdb-thread-buffer-gud-command):
(def-gdb-set-positive-number):
(def-gdb-memory-format):
(def-gdb-memory-unit):
(def-gdb-memory-show-page):
* lisp/progmodes/compile.el (define-compilation-mode):
* lisp/progmodes/cc-vars.el (defcustom-c-stylevar):
* lisp/obsolete/cl.el (define-setf-expander):
(defsetf):
(define-modify-macro):
* lisp/obsolete/cl-compat.el (defkeyword):
* lisp/net/hmac-def.el (define-hmac-function):
* lisp/international/mule-conf.el (define-iso-single-byte-charset):
* lisp/international/ccl.el (define-ccl-program):
* lisp/image.el (defimage):
* lisp/gnus/gmm-utils.el (defun-gmm):
* lisp/ezimage.el (defezimage):
* lisp/erc/erc.el (define-erc-module):
* lisp/emacs-lisp/shortdoc.el (define-short-documentation-group):
* lisp/emacs-lisp/eieio.el (defclass):
* lisp/emacs-lisp/eieio-compat.el (defgeneric):
(defmethod):
* lisp/emacs-lisp/easy-mmode.el (define-minor-mode):
(define-globalized-minor-mode):
* lisp/emacs-lisp/derived.el (define-derived-mode):
* lisp/emacs-lisp/byte-run.el (defsubst):
(define-obsolete-function-alias):
(define-obsolete-variable-alias):
* lisp/custom.el (defcustom):
(defface):
(defgroup):
(deftheme):
* lisp/cedet/semantic/wisent.el (define-wisent-lexer):
* lisp/cedet/semantic/lex.el (define-lex):
(define-lex-analyzer):
(define-lex-regex-analyzer):
(define-lex-simple-regex-analyzer):
(define-lex-block-analyzer):
(define-lex-keyword-type-analyzer):
(define-lex-sexp-type-analyzer):
(define-lex-regex-type-analyzer):
(define-lex-string-type-analyzer):
(define-lex-block-type-analyzer):
* lisp/cedet/semantic/lex-spp.el
(define-lex-spp-macro-declaration-analyzer):
(define-lex-spp-macro-undeclaration-analyzer):
(define-lex-spp-include-analyzer):
* lisp/cedet/semantic/dep.el
(defcustom-mode-local-semantic-dependency-system-include-path):
* lisp/cedet/semantic/decorate/mode.el
(define-semantic-decoration-style):
* lisp/cedet/mode-local.el (define-child-mode):
(define-overloadable-function):
(define-mode-local-override):
* lisp/calc/calc.el (defcalcmodevar):
(defmath): Explicitly mark all macros that have names that start
with "def" that should indent defunly-like (bug#43329).
2021-10-13 21:52:57 +02:00
Lars Ingebrigtsen
43f59b91aa Mark all def* functions that should indent as `defun'
* lisp/abbrev.el (define-abbrev):
(define-abbrev-table): Mark all functions that have names that
start with "def" that should indent according to the current
heuristics (bug#43329).
* lisp/autoinsert.el (define-auto-insert):

* lisp/button.el (define-button-type):

* lisp/subr.el (define-key-after):
(define-mail-user-agent):
(define-keymap):

* lisp/widget.el (define-widget):

* lisp/emacs-lisp/package.el (define-package):

* lisp/international/mule-cmds.el (define-char-code-property):

* lisp/international/mule.el (define-charset):
(define-coding-system):
(define-translation-table):
(define-translation-hash-table):
2021-10-13 21:52:57 +02:00
Paul Eggert
8e072e6abe Merge from origin/emacs-28
efb1cd7fa9 ; * etc/charsets/README: Update the format documentation.
cc796b7409 Tramp doc cleanup
a338d46060 Make emacs-lisp-byte-compile-and-load load the .elc file a...
3eac7dc780 Fix point movement in image-dired
4e9452a399 Improve shortdoc for vector
f223ac6ef9 Fix test bug when calloc returns null
ebeaa54f19 Pacify GCC 11 -fanalyzer on x86-64
56d1f42f30 Improve handling of non-character events in input methods
3fbe6fd367 ; Fix mistakes in last doc rewording about shorthands
2021-10-13 11:19:12 -07:00
Lars Ingebrigtsen
913a7d30a3 Allow inhibiting `not-unused' warnings
* lisp/emacs-lisp/bytecomp.el (byte-compile-warning-types): Allow
inhibiting the `not-unused' warning (bug#31641).  (There has been
some discussion about removing the `not-unused' warning, but it's
still in there, so making it possible to inhibit it seems like the
right thing to do.)
* lisp/emacs-lisp/cconv.el (cconv--analyze-use): Don't warn about
`not-unused'.
2021-10-13 19:00:31 +02:00
Stefan Kangas
4e9452a399 Improve shortdoc for vector
* lisp/emacs-lisp/shortdoc.el (vector): Improve shortdoc with titles.
Add mapc.  Fix typo where 'seq-reduce' is incorrectly written as
'reduce'.
2021-10-13 05:04:34 +02:00