1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2025-01-23 18:47:57 +00:00
Commit Graph

6101 Commits

Author SHA1 Message Date
Juri Linkov
9eaad4de02 * lisp/emacs-lisp/edebug.el (edebug-remove-instrumentation): Use 'user-error'. 2019-12-13 01:47:03 +02:00
Mattias Engdegård
f16766a0eb Use or' instead of union' for charset union in rx
Design change suggested by Stefan Monnier.

* doc/lispref/searching.texi (Rx Constructs):
* etc/NEWS: Document.
* lisp/emacs-lisp/rx.el (rx--translate-or): Detect charset arguments.
(rx--charset-p): New.
(rx--translate-not, rx--charset-intervals, rx--translate-union):
Change from `union' to `or'.
(rx--translate-form, rx--builtin-forms, rx): Remove `union'.
* test/lisp/emacs-lisp/rx-tests.el (rx-union, rx-def-in-union)
(rx-intersection): Rename tests and change `union' to `or' and `|'.
2019-12-12 23:47:25 +01:00
Stefan Monnier
7a498af10a * lisp/emacs-lisp/debug.el (debug-on-entry): Allow undefined functions
Allow placing debug-on-entry on a function not-yet-defined, which
is convenient when the problem you're investigating happens while
the relevant files are loaded.
2019-12-11 20:24:44 -05:00
Mattias Engdegård
ea93326cc0 Add union' and intersection' to rx (bug#37849)
These character set operations, together with `not' for set
complement, improve the compositionality of rx, and reduce duplication
in complicated cases.  Named character classes are not permitted in
set operations.

* lisp/emacs-lisp/rx.el (rx--translate-any): Split into multiple
functions.
(rx--foldl, rx--parse-any, rx--generate-alt, rx--intervals-to-alt)
(rx--complement-intervals, rx--intersect-intervals)
(rx--union-intervals, rx--charset-intervals, rx--charset-union)
(rx--charset-all, rx--charset-intersection, rx--translate-union)
(rx--translate-intersection): New.
(rx--translate-not, rx--translate-form, rx--builtin-forms, rx):
Add `union' and `intersection'.
* test/lisp/emacs-lisp/rx-tests.el (rx-union ,rx-def-in-union)
(rx-intersection, rx-def-in-intersection): New tests.
* doc/lispref/searching.texi (Rx Constructs):
* etc/NEWS:
Document `union' and `intersection'.
2019-12-10 22:37:47 +01:00
Paul Eggert
d1a791f8ed Spelling fixes 2019-12-09 18:45:18 -08:00
Juri Linkov
d8d537e173 * lisp/emacs-lisp/map-ynp.el (read-answer): Use [remap self-insert-command]
This reverts the last change that replaced [remap self-insert-command]
with [t].  The user should have freedom of using any command
in the minibuffer.  (bug#32738)
2019-12-10 01:53:16 +02:00
Juri Linkov
51176ee81e * lisp/emacs-lisp/map-ynp.el (read-answer): Allow more SHORT-ANSWER types.
Treat SHORT-ANSWER as a character is characterp returns non-nil.
Otherwise, use key-description to print it.
Use catch-all [t] in keymap instead of [remap self-insert-command].
(bug#32738)
2019-12-09 01:27:29 +02:00
Mattias Engdegård
f5672b24a8 Don't use the return value of 'push'
Although 'push' returns the modified list, it isn't actually
documented to do so, so don't rely on it.

* lisp/emacs-lisp/rx.el (rx--translate-any): Add progn.
2019-12-04 11:37:26 +01:00
Mattias Engdegård
a6b598518c Avoid duplicated character classes in rx
For example, (any digit digit) should produce "[[:digit:]]",
not "[[:digit:][:digit:]]".

* lisp/emacs-lisp/rx.el (rx--translate-any): Deduplicate character classes.
* test/lisp/emacs-lisp/rx-tests.el (rx-any): Add test case.
2019-12-03 15:17:37 +01:00
Juri Linkov
9a911b4af5 New functions window-state-buffers and tab-bar-get-buffer-tab (bug#38354)
* lisp/window.el (window-state-buffers): New function.
* lisp/tab-bar.el (tab-bar-get-buffer-tab): New function.

* lisp/emacs-lisp/seq.el (seq-some): Add autoload cookie.

* lisp/desktop.el (desktop-buffers-not-to-save-function): New variable.
(desktop-save-buffer-p): Use it.
2019-12-03 01:40:12 +02:00
Juri Linkov
d64ea182fb Use run-with-idle-timer instead of debounce for responsive image scaling.
* lisp/emacs-lisp/timer.el (debounce, debounce-reduce): Revert macro addition.
https://lists.gnu.org/archive/html/emacs-devel/2019-11/msg01133.html

* lisp/image.el (image-increase-size, image-decrease-size):
Use run-with-idle-timer.
(image--change-size): Rename back from image--change-size-function.

* lisp/image-mode.el (image-mode--setup-mode): Remove hooks
window-size-change-functions and window-selection-change-functions (bug#32672)
(image-fit-to-window): Rename from image--window-change-function.
(image--window-state-change): Rename from image--window-change.
Use run-with-idle-timer.
2019-11-30 23:16:03 +02:00
Noam Postavsky
b2790db049 Improve errors & warnings due to fancy quoted vars (Bug#32939)
Add some hints to the message for byte compiler free & unused variable
warnings, and 'void-variable' errors where the variable has confusable
quote characters in it.
* lisp/help.el (uni-confusables), uni-confusables-regexp): New
constants.
(help-command-error-confusable-suggestions): New function, added to
`command-error-function'.
(help-uni-confusable-suggestions): New function.
* lisp/emacs-lisp/bytecomp.el (byte-compile-variable-ref):
* lisp/emacs-lisp/cconv.el (cconv--analyze-use): Use it.

* lisp/emacs-lisp/lisp-mode.el
(lisp--match-confusable-symbol-character): New function.
(lisp-fdefs): Use it to fontify confusable characters with
font-lock-warning-face when they occur in symbol names.
* doc/lispref/modes.texi (Faces for Font Lock):
* doc/lispref/objects.texi (Basic Char Syntax): Recommend backslash
escaping of confusable characters, and mention new fontification.
* etc/NEWS: Announce the new fontification behavior.
* test/lisp/emacs-lisp/lisp-mode-tests.el (lisp-fontify-confusables):
New test.
2019-11-28 18:10:07 -05:00
Juri Linkov
4b5d04be44 Use new macro debounce-reduce to make mouse scaling of images more responsive
* lisp/emacs-lisp/timer.el (debounce, debounce-reduce): New macros.

* lisp/image.el (image-increase-size, image-decrease-size):
Use funcall to call image--change-size-function.
(image--change-size-function): Move code from defun of
image--change-size to defvar that has the value of lambda
returned from debounce-reduce.  (Bug#38187)
2019-11-24 00:22:46 +02:00
Michael Heerdegen
311ca036f4 Fix edebug instrumentation removing from advised functions
* lisp/emacs-lisp/edebug.el (edebug-remove-instrumentation): Handle
advised functions correctly.
2019-11-23 14:20:50 +01:00
dickmao
045cfbef09 Refix conditional step clauses in cl-loop
* lisp/emacs-lisp/cl-macs.el
(cl--loop-bindings, cl--loop-symbol-macs, cl-loop):
Add cl--loop-conditions, remove cl--loop-guard-cond.
(cl--push-clause-loop-body): Apply clause to both cl--loop-conditions
and cl--loop-body
(cl--parse-loop-clause): Use cl--push-clause-loop-body.
* test/lisp/emacs-lisp/cl-macs-tests.el (cl-macs-loop-and-assignment):
Use docstring.
(cl-macs-loop-for-as-arith): Removed expected failure.
(cl-macs-loop-conditional-step-clauses): Add some tests (bug#29799).
2019-11-22 15:53:58 +01:00
Eli Zaretskii
f373cec7f5 Fix uses of inhibit-message in package.el
* lisp/emacs-lisp/package.el (package-generate-autoloads)
(package--compile, package--save-selected-packages): Don't use
'inhibit-message' to bind 'noninteractive' and 'save-silently',
since 'inhibit-message' already disables all messages.
(Bug#38264)
2019-11-22 16:36:25 +02:00
Stefan Monnier
c5de861af1 * lisp/emacs-lisp/smie.el (smie-next-sexp): Fix bug#38255
Handle the case where the token is not in `smie-grammar`, either because
the caller is making an error, or because it's a paren-like token that's
not handled in the grammar but directly via the syntax tables.
2019-11-21 18:25:00 -05:00
Lars Ingebrigtsen
bc4190b3f4 Make pp-buffer into a command
* lisp/emacs-lisp/pp.el (pp-buffer): Make into a command (bug#38306).
2019-11-21 14:09:32 +01:00
Lars Ingebrigtsen
5c5c1b5593 Make with-suppressed-warnings work for macros, too
* lisp/emacs-lisp/macroexp.el (macroexp-macroexpand): Pass the
macro/alias symbol on to byte-compile-warning-enabled-p so that
with-suppressed-warnings works for macros, too.
2019-11-20 12:28:43 +01:00
Lars Ingebrigtsen
2e92f176a3 Fix cl-prettyexpand in the non-FULL case
* lisp/emacs-lisp/cl-extra.el (cl-prettyexpand): This function has
apparently not worked for at least a couple of decades
(bug#38206) unless supplied with a FULL parameter.  Make the FULL
parameter obsolete and make the function always work as it did
with a non-nil FULL.
2019-11-18 11:02:27 +01:00
Lars Ingebrigtsen
ecc21845ea Make edebug-remove-instrumentation remove macro instrumentation
* lisp/emacs-lisp/edebug.el (edebug-remove-instrumentation):
Macros can also have edebug instrumentation, so remove that as
well (bug#38195).
2019-11-15 09:00:53 +01:00
Lars Ingebrigtsen
d9ea77af4c Allow using edebug-remove-instrumentation more fine-grained
* lisp/emacs-lisp/edebug.el (edebug-remove-instrumentation):
Prompt the user for what functions to remove instrumentation from
a la cancel-edebug-on-entry (bug#38195).
2019-11-14 06:20:04 +01:00
Stefan Monnier
6eaf62df20 * lisp/emacs-lisp/easymenu.el (easy-menu-make-symbol): Fix last change 2019-11-12 08:39:18 -05:00
Paul Eggert
6b4a97c1c7 Fix some quoting glitches in doc strings 2019-11-11 10:32:53 -08:00
Paul Eggert
b6942c0c37 Document Lisp floats a bit better
* doc/lispref/numbers.texi (Float Basics):
* doc/misc/cl.texi (Implementation Parameters):
* lisp/emacs-lisp/cl-lib.el (cl-most-positive-float)
(cl-least-positive-float)
(cl-least-positive-normalized-float, cl-float-epsilon)
(cl-float-negative-epsilon):
Document IEEE floating point better.  Don’t suggest that Emacs
might use some floating-point format other than IEEE format, as
Emacs currently assumes IEEE in several places and there seems
little point in removing those assumptions.
2019-11-10 15:04:20 -08:00
Juri Linkov
7e151f5bcf * lisp/autorevert.el: Use 'minibuffer-message' to not obscure the prompt.
* lisp/autorevert.el (auto-revert-handler): Use 'minibuffer-message'
instead of 'message'.  Call it from the original window's buffer
that in case of the minibuffer should be current, so
minibuffer-message could add a message to it.  (Bug#34614)

* lisp/emacs-lisp/ert-x.el (ert--make-message-advice): Add nil to
the list of values to not use for format-message, because
minibuffer-message calls 'message' with nil argument, and tests fail.
2019-11-10 23:21:46 +02:00
Juri Linkov
04ab674707 Add CHARS arg to read-char-from-minibuffer compatible with read-char-choice.
* lisp/simple.el (read-char-history):
Rename from read-char-from-minibuffer-history.  (Bug#38076)
(read-char-from-minibuffer-insert-char):
Rename from read-char-from-minibuffer-self-insert.
(read-char-from-minibuffer-map-hash): New defconst.
(read-char-from-minibuffer-insert-other): New command.
(read-char-from-minibuffer): Add optional args CHARS and HISTORY.
(zap-to-char): Use 'read-char-history as HISTORY arg of
read-char-from-minibuffer.

* lisp/emacs-lisp/map-ynp.el (read-answer): Use sit-for instead of sleep-for.
Replace short answer history yes-or-no-p-history with read-char-history.
2019-11-10 00:21:26 +02:00
Stefan Monnier
a070bd1c8b * lisp/emacs-lisp/easymenu.el: Don't quote lambdas
(easy-menu-do-define, easy-menu-make-symbol): Replace `(lambda ..)
with a closure.
2019-11-07 17:09:16 -05:00
Stefan Kangas
ddb797cf4c Clean up major mode check in package-menu-mode
* lisp/emacs-lisp/package.el (package--ensure-package-menu-mode):
Extract function to warn about incorrect major mode...
(package-menu-toggle-hiding, package-menu-refresh)
(package-menu-execute): ...from here.
(package-menu--mark-upgrades-1): And here, but move call...
(package-menu-mark-upgrades): ...here instead.
(package-menu-hide-package, package-menu-mark-delete)
(package-menu-mark-install, package-menu-mark-unmark)
(package-menu-quick-help, package-menu-get-status)
(package-menu-filter-by-keyword, package-menu-filter-by-name)
(package-menu-clear-filter): Add call to new function.  (Bug#37891)
2019-11-07 04:12:01 +01:00
Stefan Kangas
d30f5e7eee Fix problem with my last commit in package.el
* lisp/emacs-lisp/package.el (package-menu--refresh-archives): Rename
from duplicated name package-menu--refresh.  (Bug#38084)
(package-menu-mode, list-packages): Use new name.
2019-11-06 15:01:37 +01:00
Stefan Kangas
0661a39d1b Avoid changing value of defcustom package-enable-at-startup
* lisp/emacs-lisp/package.el (package--activated): New variable to
avoid changing value of defcustom 'package-enable-at-startup'.
(package-initialize): Don't set 'package-enable-at-startup'.
(package-initialize, package-activate-all): Set 'package--activated'
instead of 'package-enable-at-startup'.
(package--initialized): Add doc string.

* lisp/startup.el (command-line): Check if 'package--activated' is
non-nil before activating packages.

* doc/lispref/package.texi (Packaging Basics): Update docs.
2019-11-06 01:19:23 +01:00
Stefan Kangas
0c293f1520 Make 'g' refresh package data in package menu
* lisp/emacs-lisp/package.el (package-menu--refresh): Rename from
'package-menu-refresh', make internal and non-interactive.
(package-menu-mode-map, package-menu-mode-menu, package-menu-mode)
(list-packages): Use the above.  (Bug#35504)
(package-menu-refresh): Redefine as obsolete fuction alias for
'revert-buffer'.
* doc/emacs/package.texi (Package Menu): Document it.
* etc/NEWS: Announce it.
2019-11-06 00:58:57 +01:00
Stefan Kangas
d76bc06abc Declare unused macro package--push obsolete
* lisp/emacs-lisp/package.el (package--push): Declare obsolete.
2019-11-05 15:49:29 +01:00
Juri Linkov
c472df8ad3 * lisp/tab-bar.el: Filter out non-persistent tab parameters from frameset.
* lisp/tab-bar.el (frameset-filter-tabs): New function
added to 'frameset-filter-alist' for frame parameter 'tabs'.
(tab-bar--tab): Remove ws-bl/ws-bbl that are not needed because
frameset doesn't save frame buffer-list to desktop anyway.
(tab-bar-select-tab): Remove ws-bl/ws-bbl related code.

* lisp/emacs-lisp/seq.el (seq-reduce): Add autoload cookie.
2019-11-03 23:44:44 +02:00
Stefan Kangas
6297eb0fca Don't refuse to install packages without a "footer line"
* lisp/emacs-lisp/package.el (package-buffer-info): Don't signal an
error when the "footer line" is missing.  Warn only.  (Bug#26490)
* etc/NEWS: Announce it.
2019-11-02 01:30:36 +01:00
Lars Ingebrigtsen
0714d6664c Really enable setting a breakpoint without instrumenting first
* lisp/emacs-lisp/edebug.el (edebug-set-breakpoint): Really enable
setting a breakpoint without instrumenting first (bug#23469).
2019-11-01 17:42:28 +01:00
Lars Ingebrigtsen
77d4491391 Revert "Move description of value to syntax-ppss function."
This reverts commit 305dbc7e2b.

Both of the functions in question are used a lot in the sources, so move it back to the more basic function.
2019-10-30 21:26:22 +01:00
Lars Ingebrigtsen
f7673c147c Add a new ppss structure for syntax-ppss data
* lisp/emacs-lisp/syntax.el (ppss): Add a new structure to provide
accessors to the syntax-ppss data.
2019-10-30 21:25:23 +01:00
Lars Ingebrigtsen
305dbc7e2b Move description of value to syntax-ppss function.
* lisp/emacs-lisp/syntax.el (syntax-ppss): Move the description of
the return value from...

* src/syntax.c (Fparse_partial_sexp): ... here because
`syntax-ppss' is what's called over the place, and jumping through
an indirection to get to the value description is inconvenient.
2019-10-30 13:16:44 +01:00
Juri Linkov
d7f62ce0cd * lisp/tab-bar.el: Store point position and frame buffer-lists in tab.
* lisp/tab-bar.el (tab-bar--tab): Store additionally point-marker,
frame parameters buffer-list and buried-buffer-list, both for wc and ws.
Use seq-filter.
(tab-bar-select-tab): Restore point-marker after restoring
window-configuration.  Also restore frame parameters buffer-list
and buried-buffer-list both for window-configuration and window-state.
(tab-bar-history-limit, tab-bar-history--minibuffer-depth): New variables.
(tab-bar-history-current): Rename from tab-bar-history--pre-change.
(tab-bar-history--pre-change): Set tab-bar-history-current.
(tab-bar--history-change): Use seq-take for tab-bar-history-limit.
(tab-bar-history-back, tab-bar-history-forward): Restore point-marker.
(tab-bar-list-noselect): Use seq-remove.

* lisp/emacs-lisp/seq.el (seq-take, seq-filter): Add autoload cookie.
2019-10-30 00:31:11 +02:00
Stefan Monnier
0e4dd67aae * lisp/emacs-lisp/seq.el: Don't require cl-lib.
(seq-subseq): Move cl-subseq's code here instyead of calling it.
* lisp/emacs-lisp/cl-extra.el (cl-subseq): Use seq-subseq.
2019-10-27 13:25:00 -04:00
Eli Zaretskii
fc0f98a8a8 Fix point position after revert-buffer in tabulated-list mode
* lisp/emacs-lisp/tabulated-list.el (tabulated-list-print):
Don't use count-screen-lines, as it is unreliable when lines
are truncated and the region ends before a newline (the root
cause is in vertical-motion, but is very hard to fix there).
Instead, use vertical-motion directly, as the problems with
counting/not counting the newline that ends the region are not
relevant to what we need in this function, which is simply the
number of the current window line.  (Bug#37941)
2019-10-27 17:07:47 +02:00
Mattias Engdegård
cbd439e785 Expand rx definitions inside (not ...)
* lisp/emacs-lisp/rx.el (rx--translate-not):
* test/lisp/emacs-lisp/rx-tests.el (rx-not, rx-def-in-not):
* doc/lispref/searching.texi (Rx Constructs, Extending Rx):

Allow user-defined rx constructs to be expanded inside (not ...)
forms, for better composability (bug#37849).
2019-10-27 09:54:54 +01:00
Juri Linkov
5a9a01797b * lisp/tab-bar.el (tab-bar-switch-to-recent-tab): New command.
(tab-recent): Alias to tab-bar-switch-to-recent-tab.
(tab-bar--tab-index-recent): New internal function.
(tab-bar-close-tab-select): Add new default option 'recent'.
(tab-bar-close-tab): Handle it.

* lisp/emacs-lisp/seq.el (seq-sort-by, seq-remove): Add autoload.
2019-10-27 01:16:10 +03:00
Mattias Engdegård
539d0411bb rx.el: Refactor user-definition expansion
* lisp/emacs-lisp/rx.el (rx--translate-not): Simplify structure.
* lisp/emacs-lisp/rx.el (rx--expand-def): New.
(rx--translate-symbol, rx--translate-form): Use rx--expand-def.
2019-10-24 10:23:00 +02:00
Mattias Engdegård
0e9d92146e rx doc string tweaks
* lisp/emacs-lisp/rx.el (rx--translate-seq, rx--translate-or, rx):
Say "zero or more" instead of "one or more" where applicable.
2019-10-22 15:37:51 +02:00
Lars Ingebrigtsen
7f5d92e643 Make edebug-eval-last-sexp interactively take a zero prefix
* lisp/emacs-lisp/edebug.el (edebug-eval-last-sexp): Make the zero
prefix work analogously to in eval-last-sexp (bug#28895).
(edebug-eval-print-last-sexp): Ditto.
2019-10-22 13:12:08 +02:00
Stefan Monnier
7f5db3f40c * lisp/emacs-lisp/cursor-sensor.el: Make it possible to reveal invisible text
(cursor-sensor-mode): Hook into post-command-hook as well.
(cursor-sensor--detect): Make argument optional.
2019-10-21 16:35:38 -04:00
Lars Ingebrigtsen
cf294d78a1 Tiny clean-up of previous edebug patch
* lisp/emacs-lisp/edebug.el (edebug--overlay-breakpoints): Clean
up code slightly.
2019-10-21 22:28:49 +02:00
Lars Ingebrigtsen
7e5f3a8091 Ensure we always remove the breakpoint overlays
* lisp/emacs-lisp/edebug.el (edebug--display-1): Remove the
overlays here -- this cleans up after exiting no matter how we
exited.
2019-10-21 22:22:16 +02:00