Commit graph

8618 commits

Author SHA1 Message Date
Lars Ingebrigtsen
119d59531e Make easy-mmode-define-keymap obsolete
* lisp/emacs-lisp/easy-mmode.el (easy-mmode-define-keymap): Make
obsolete.
(define-minor-mode): Add comment.
2022-09-01 13:42:19 +02:00
Lars Ingebrigtsen
8bb5c1bfec Make easy-mmode-defmap obsolete and adjust only caller
* lisp/emacs-lisp/easy-mmode.el (easy-mmode-defmap): Make obsolete.
* lisp/progmodes/gud.el (gud-menu-map): Use easy-menu-define.
2022-09-01 13:39:14 +02:00
Lars Ingebrigtsen
b28b2cefae Fix warning about obsoleted generalized variables
* lisp/emacs-lisp/bytecomp.el (byte-compile-warn-obsolete):
Autoload so that the call here from gv.el (about obsolete
generalized variables) doesn't bug out (bug#57394).
2022-08-25 14:54:49 +02:00
Lars Ingebrigtsen
a8a3608c07 Make frame-width obsolete as a generalized variable
* lisp/emacs-lisp/gv.el (frame-width): Make obsolete as
generalized variable.
2022-08-25 14:42:59 +02:00
Lars Ingebrigtsen
de3efaa683 Add NEWS entry about obsoleted generalized variables 2022-08-23 17:04:55 +02:00
Stefan Kangas
8673c0e256 Make XEmacs compat alias face-background-pixmap obsolete
* lisp/faces.el (face-background-pixmap)
(set-face-background-pixmap): Make XEmacs compat aliases obsolete in
favor of 'face-stipple' and 'set-face-stipple'.  Update callers.

* lisp/emacs-lisp/gv.el (face-background-pixmap): Make XEmacs
alias obsolete as a generalized variable.
(face-stipple): New generalized variable.
* doc/misc/cl.texi (Setf Extensions): Refer to above new generalized
variable instead of the obsolete one.
2022-08-23 16:51:31 +02:00
Stefan Kangas
4ee8a6c124 ; Minor doc fix in easy-menu-{add,remove}
* lisp/emacs-lisp/easymenu.el (easy-menu-remove, easy-menu-add):
Minor doc fix: don't explain what this does in XEmacs.
2022-08-23 16:24:54 +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
915efbff98 Make buffer-local-value obsolete as a generalized variable
* lisp/electric.el (electric-indent-local-mode)
(electric-layout-local-mode, electric-quote-local-mode):
* lisp/elec-pair.el (electric-pair-local-mode): Adjust usage.
* lisp/emacs-lisp/gv.el (make-obsolete-generalized-variable): Move
since we're using it earlier in the file.
(buffer-local-value): Make obsolete as a generalized variable
since the semantics are unclear (bug#26624).
2022-08-23 12:22:42 +02:00
Stefan Kangas
b7e867b841 Make point-at-eol and point-at-bol obsolete
* lisp/subr.el (point-at-eol, point-at-bol): Make XEmacs compat
aliases obsolete in favor of `pos-bol'/'line-beginning-position' or
'pos-eol'/'line-end-position'.  Update callers.
Ref: https://lists.gnu.org/r/emacs-devel/2022-08/msg00853.html
2022-08-23 04:54:57 +02:00
Lars Ingebrigtsen
06d7161476 Fix some no-X build warnings
* lisp/cus-edit.el (fringe-bitmap-p): Autoload.

* lisp/image.el (clear-image-cache): Declare.

* lisp/mouse.el (dnd-begin-file-dram): Autoload.

* lisp/thumbs.el (image-supported-file-p): Declare (bug#57342).

* lisp/mail/rmailmm.el (rmail-mime-set-bulk-data):
* lisp/emacs-lisp/icons.el (icons--create): Avoid warnings on no-X
builds.
2022-08-22 19:22:33 +02:00
Stefan Kangas
ac90530a0a Prefer pos-bol and pos-eol in tabulated-list.el
* lisp/emacs-lisp/tabulated-list.el (tabulated-list-print)
(tabulated-list-print-entry, tabulated-list-delete-entry)
(tabulated-list-set-col, tabulated-list-previous-column): Prefer
pos-bol and pos-eol.
2022-08-22 15:08:48 +02:00
Stefan Kangas
a7557f2483 ; * lisp/emacs-lisp/shortdoc.el (buffer): Improve sorting. 2022-08-22 15:08:48 +02:00
Lars Ingebrigtsen
d921424891 Remove probably debugging code in reb-fontify-string-re
* lisp/emacs-lisp/re-builder.el (reb-fontify-string-re): Remove
code that looks like left-over debugging code.  This fixes a
compilation warning.
2022-08-22 13:00:36 +02:00
Andrea Corallo
a5e36575ae * lisp/emacs-lisp/comp.el (comp-known-type-specifiers): Fix some type spec 2022-08-22 10:29:18 +02:00
Lars Ingebrigtsen
ae5fe348fb Revert "Make the generalized buffer-local-variable obsolete"
This reverts commit bfe222288e.

This led to the local modes not working.
2022-08-22 00:14:07 +02:00
Lars Ingebrigtsen
bfe222288e Make the generalized buffer-local-variable obsolete
* lisp/paren.el (show-paren-local-mode):
* lisp/electric.el (electric-indent-local-mode)
(electric-layout-local-mode, electric-quote-local-mode):
* lisp/elec-pair.el (electric-pair-local-mode): Don't use it.

* lisp/emacs-lisp/bytecomp.el (byte-compile-warn-obsolete): Autoload.

* lisp/emacs-lisp/gv.el (buffer-local-variable): Make obsolete
(bug#26624).

* lisp/emacs-lisp/gv.el (make-obsolete-generalized-variable): Move
to allow usage.
2022-08-21 23:38:09 +02:00
Lars Ingebrigtsen
48aacbf292 Make many seldom-used generalized variables obsolete
The vast majority of these are unused in-tree, and many of them
perform actions that aren't obvious when reading the code.

* lisp/server.el (server-ensure-safe-dir): Prefer with-file-modes
over letf-ing default-file-modes.
(server-start): Ditto.

* lisp/winner.el (winner-set-conf): Don't use generalized variable
window-height.

* lisp/emacs-lisp/gv.el: Make most little-used generalized
variables obsolete.

* lisp/org/oc-basic.el (org-cite-basic--set-keymap): Adjust
buffer-substring generalized variable usage.
2022-08-21 22:12:43 +02:00
Lars Ingebrigtsen
6ddcf67052 Make it possible to mark generalized variables as obsolete
* doc/lispref/variables.texi (Adding Generalized Variables):
Document it.

* lisp/emacs-lisp/bytecomp.el (byte-compile-warn-obsolete): Alter
the interface so that it can also be used by generalized variable
warnings.
(byte-compile-function-warn): Adjust caller.
(byte-compile-check-variable): Adjust caller.

* lisp/emacs-lisp/gv.el (gv-get): Warn about obsolete generalized
variables (bug#49730).
(make-obsolete-generalized-variable): New function.
2022-08-21 21:46:14 +02:00
Lars Ingebrigtsen
958924a812 Mention delete-line in shortdoc
* lisp/emacs-lisp/shortdoc.el (buffer): Mention delete-line.
2022-08-21 18:17:56 +02:00
Mattias Engdegård
965fad0d36 Update function properties and optimisations
* lisp/emacs-lisp/byte-opt.el (byte-opt--bool-value-form):
Recognise boolean identity in aset, put, function-put and puthash.
* lisp/emacs-lisp/byte-opt.el (byte-compile-trueconstp):
Mark more functins as non-nil-returning, including the new
pos-bol and pos-eol.
* lisp/emacs-lisp/byte-opt.el (side-effect-free-fns):
Mark pos-bol and pos-eol as side-effect-free.
2022-08-21 16:26:59 +02:00
Mattias Engdegård
f57297c8b2 * lisp/emacs-lisp/shortdoc.el (buffer): Add missing functions
Add preceding-char and char-before because following-char and
char-after were already there.
2022-08-21 16:18:03 +02:00
Lars Ingebrigtsen
2614e53216 Rename newly-added eol/bol functions to pos-eol/pos-bol
* lisp/emacs-lisp/shortdoc.el (buffer):
* doc/lispref/positions.texi (Text Lines): Adjust.
* src/editfns.c (Fpos_bol): Rename from Fpos.
(Fpos_eol): Rename from Feol.
2022-08-21 14:04:52 +02:00
Mattias Engdegård
9a7b3673e0 Move while syntax check from optimiser to macroexpand
* lisp/emacs-lisp/byte-opt.el (byte-optimize-while): Move check...
* lisp/emacs-lisp/macroexp.el (macroexp--expand-all): ...here.
2022-08-19 21:23:48 +02:00
Stefan Kangas
935e4da0e1 Display new keybinding in obsolete command warning
* lisp/emacs-lisp/macroexp.el (macroexp--obsolete-warning):
* lisp/simple.el (command-execute): When warning about an obsolete
command, display the keybinding for the new command.
2022-08-19 19:00:24 +02:00
Stefan Kangas
b7d6ebff07 ; Delete not-useful comments referring to Emacs 19. 2022-08-19 18:05:51 +02:00
Lars Ingebrigtsen
f117b5df4d Add new functions eol and bol
* doc/lispref/positions.texi (Text Lines): Document them
* lisp/emacs-lisp/shortdoc.el: Mention them, and also the
buffer/line predicates.

* src/editfns.c (bol): New function.
(Fbol): New defun.
(Fline_beginning_position): Use `bol'.
(eol): New function.
(Feol): New defun.
(Fline_end_position): Use `eol'.
2022-08-19 15:22:36 +02:00
Andrea Corallo
0bd96806ef * Rename `comp--typeof-builtin-types'
* lisp/emacs-lisp/comp-cstr.el (comp--typeof-builtin-types): Rename.
(comp-normalize-valset, comp-common-supertype-2): Update.
2022-08-18 23:41:39 +02:00
Andrea Corallo
715f1ebea3 * lisp/emacs-lisp/comp-cstr.el (comp--all-builtin-types): Remove 2022-08-18 23:36:19 +02:00
Stefan Kangas
f97668c38f Merge from origin/emacs-28
ef1e68f11d * lisp/image-mode.el (image-mode-as-hex): Fix toggle instr...
dc0fce3a7d ; lisp/image-mode.el: Fix typo.
254ba1d3e5 * lisp/image-mode.el: Improve commentary.
ac43ac1af9 cl-reduce doc string improvement
2022-08-18 19:21:32 +02:00
Mattias Engdegård
1ad0d60740 Fix string-to-syntax signature in comp-known-type-specifiers
* lisp/emacs-lisp/comp.el (comp-known-type-specifiers):
`string-to-syntax` can return nil.
2022-08-18 17:25:41 +02:00
Andrea Corallo
67ec994180 * lisp/emacs-lisp/comp.el (comp-known-type-specifiers): Fix some type 2022-08-18 17:11:59 +02:00
Mattias Engdegård
9361c83318 More non-nil-returning functions in source optimisation
This change was partially generated and mechanically cross-validated
with function type information from comp-known-type-specifiers in
comp.el.

* lisp/emacs-lisp/byte-opt.el (byte-compile-trueconstp):
Extend list of functions and fix a typo (logxor).
2022-08-18 17:10:46 +02:00
Lars Ingebrigtsen
74e830768d Make GEN message from loaddefs-generate nicer
* lisp/emacs-lisp/loaddefs-gen.el (loaddefs-generate): Shorten the
informational GEN file relative to the stated directory
(bug#57265).  This makes the message nicer for ELPA packages.
2022-08-18 15:12:55 +02:00
Colin Woodbury
ac43ac1af9 cl-reduce doc string improvement
* lisp/emacs-lisp/cl-seq.el (cl-reduce): Explain what happens when
using :from-end (bug#57273).
2022-08-18 15:07:08 +02:00
Stefan Kangas
dae4fc3adf Improve cryptic syntax switch message in re-builder
* lisp/emacs-lisp/re-builder.el (reb-restart-font-lock): Move message
from here...
* lisp/emacs-lisp/re-builder.el (reb-change-syntax): ...to here.
Change it to be less cryptic.
2022-08-18 13:19:42 +02:00
Andrea Corallo
3e042c80ce * lisp/emacs-lisp/bytecomp.el (byte-compile-log-1): Create buffer if necessary 2022-08-17 23:35:46 +02:00
Mattias Engdegård
fb98c4a406 Improved null (alias not) optimisation
Take static boolean information of the argument into account.

* lisp/emacs-lisp/byte-opt.el (byte-optimize-not): New.
2022-08-16 20:44:50 +02:00
Mattias Engdegård
621550c076 Improved and and or optimisation
* lisp/emacs-lisp/byte-opt.el (byte-optimize-and, byte-optimize-or):
Rewrite.  Avoid branching on arguments statically known to be true or
false, and hoist code out to an unconditional prefix when possible.
2022-08-16 20:44:50 +02:00
Mattias Engdegård
e618b6faee Improved if and while optimisation
Recognise some more special cases:

  (if X nil t)      -> (not X)
  (if X t)          -> (not (not X))
  (if X t nil)      -> (not (not X))
  (if VAR VAR X...) -> (or VAR (progn X...))

* lisp/emacs-lisp/byte-opt.el (byte-opt-negate): New.
(byte-optimize-if): Add transformations above and refactor.
(byte-optimize-while): Better static nil-detection.
2022-08-16 20:44:50 +02:00
Mattias Engdegård
869db699ee Improved static detection of nil and non-nil expressions
* lisp/emacs-lisp/byte-opt.el (byte-opt--bool-value-form): New.
(byte-compile-trueconstp, byte-compile-nilconstp): Determine a static
nil or non-nil result in more cases.  These functions have grown and
are no longer defsubst.
2022-08-16 20:44:50 +02:00
Yury Kholodkov
d5ee49c25c Fix variable types in warnings-suppress
* lisp/emacs-lisp/warnings.el (warnings-suppress): The type of
these user options is a list of lists of symbols, not a list of
symbols (bug#57183).

Copyright-paperwork-exempt: yes
2022-08-15 09:36:06 +02:00
Lars Ingebrigtsen
ead4b914ca Fix up the exclusion logic in loaddefs-generate
* lisp/emacs-lisp/loaddefs-gen.el (loaddefs-generate): Allow
excluding files completely (bug#57144).
2022-08-15 08:29:28 +02:00
Lars Ingebrigtsen
d33a6b9069 Tweak autoloads of defsubsts containing spaces/control chars
* lisp/emacs-lisp/loaddefs-gen.el (loaddefs-generate--print-form):
Escape control chars in bodies so that we don't end up with
trailing spaces if we're autoloading a defsubst containing
"\\`[ \t\n\r]*\\'".
2022-08-15 08:24:29 +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
Stefan Monnier
3a9c803f24 * lisp/emacs-lisp/ring.el (ring): Define as a type 2022-08-14 12:30:06 -04:00
Stefan Monnier
1faeef7924 (compiled-function-p): New function (bug#56648)
* lisp/subr.el (compiled-function-p): New function.

* test/lisp/international/ucs-normalize-tests.el (ucs-normalize-part1):
* lisp/gnus/gnus.el (gnus):
* lisp/mh-e/mh-e.el (mh-version):
* lisp/emacs-lisp/macroexp.el (emacs-startup-hook):
* lisp/emacs-lisp/cl-macs.el (compiled-function):
* lisp/emacs-lisp/bytecomp.el (byte-compile-fdefinition)
(byte-compile, display-call-tree):
* lisp/emacs-lisp/byte-opt.el (<toplevel-end>):
* lisp/emacs-lisp/advice.el (ad-compiled-p):
* lisp/cedet/semantic/bovine.el (semantic-bovinate-stream):
* lisp/loadup.el (macroexpand-all):
* admin/unidata/unidata-gen.el (unidata--ensure-compiled): Use it.

* lisp/emacs-lisp/pcase.el (pcase-mutually-exclusive-predicates):
Add entries for it.
(pcase--split-pred): Use it.

* lisp/help-fns.el (help-fns-function-description-header): Use `functionp`.
(help-fns--var-safe-local): Use `compiled-function-p`.
2022-08-14 12:30:05 -04:00
Mattias Engdegård
1d8712bcc9 Strength-reduce apply with (list ...) as tail argument
* lisp/emacs-lisp/byte-opt.el (byte-optimize-apply):
Transform (apply F ... (list X ...)) -> (funcall F ... X ...)
2022-08-14 15:43:12 +02:00
Mattias Engdegård
e99d7c4d62 Simplify code using take, ntake and butlast
* lisp/calc/calc-vec.el (calcFunc-rhead):
* lisp/calc/calc.el (calc-top-list, calc-pop):
* lisp/emacs-lisp/ert.el (ert-summarize-tests-batch-and-exit):
Simplify.
2022-08-14 15:43:12 +02:00
Štěpán Němec
b93e14fa0f ; advice--interactive-form: Fix a typo introduced in recent change
* lisp/emacs-lisp/nadvice.el (advice--interactive-form): Fix a typo.
2022-08-14 10:23:29 +02:00