Eli Zaretskii [Thu, 5 Aug 2021 17:42:10 +0000 (20:42 +0300)]
Fix files-tests on non-Posix systems
* test/lisp/files-tests.el (files-test-auto-save-name-default)
(files-test-auto-save-name-transform)
(files-test-auto-save-name-unique, files-test-lock-name-default)
(files-test-lock-name-unique): Skip the drive letter in absolute
file names on MS-Windows/MS-DOS when comparing file names against
the expected ones.
(files-tests-file-name-non-special--subprocess): Skip test on
MS-Windows/MS-DOS.
The current method of propagating constants through setq was unsound
because it relied on each setq form only being traversed at most once
during optimisation, which isn't necessarily true in general; it could
be made to miscompile code in rare cases.
Since it was only used in limited circumstances, disabling this
optimisation doesn't cost us much.
* lisp/emacs-lisp/byte-opt.el (byte-optimize-form-code-walker):
Don't update the known value when traversing `setq`.
* test/lisp/emacs-lisp/bytecomp-tests.el (bytecomp-tests--test-cases):
Add test case.
Make `M-j' work reliably if `comment-auto-fill-only-comments' is set
* lisp/simple.el (default-indent-new-line): Force breaking the
line when called interactively (bug#49849). (Perhaps the
interactive command should be rebound and call this function
instead...)
dickmao [Tue, 3 Aug 2021 16:02:48 +0000 (12:02 -0400)]
ffap ido accommodation
Now that ffap-file-finder can be ido-find-file, the
noninteractive portion of find-file-at-point cannot
assume ffap-file-finder always takes an argument
(ido-find-file does not).
* lisp/ffap.el (find-file-at-point): Do not call ffap-file-finder.
* test/lisp/ffap-tests.el (ffap-ido-mode): Test it.
Miha Rihtaršič [Wed, 4 Aug 2021 07:15:25 +0000 (09:15 +0200)]
Use `abort-minibuffers' in delsel
* lisp/delsel.el (minibuffer-keyboard-quit): Use
`abort-minibuffers' (bug#49821).
Previously, C-g was bound to abort-recursive-edit, now it is bound to
abort-minibuffers. However, after requiring delsel, it gets bound to
minibuffer-keyboard-quit, which still uses abort-recursive-edit. Use
the new function instead.
* lisp/emacs-lisp/cl-generic.el (cl-generic-generalizers): Evaluate
forms that are eql specializers. Provide backward compatibility
with a warning.
* test/lisp/emacs-lisp/cl-generic-tests.el: Add a test.
* lisp/emacs-lisp/bindat.el (bindat--type): Adhere to the new rule.
* lisp/emacs-lisp/edebug.el (edebug--match-&-spec-op): Adhere to the new rule.
* lisp/emacs-lisp/map.el (map-into): Adhere to the new rule.
* lisp/emacs-lisp/radix-tree.el (map-into): Adhere to the new rule.
* lisp/frame.el (cl-generic-define-context-rewriter): Adhere to the new rule.
* lisp/gnus/gnus-search.el
(gnus-search-transform-expression): Adhere to the new rule.
* lisp/image/image-converter.el
(image-converter--probe image-converter--convert): Adhere to the new rule.
* lisp/mail/smtpmail.el (smtpmail-try-auth-method): Adhere to the new rule.
* lisp/progmodes/elisp-mode.el
(xref-backend-definitions)
(xref-backend-apropos): Adhere to the new rule.
* lisp/progmodes/etags.el (xref-backend-identifier-at-point)
(xref-backend-identifier-completion-table)
(xref-backend-identifier-completion-ignore-case)
(xref-backend-definitions)(xref-backend-apropos): Adhere to the new rule.
* test/lisp/emacs-lisp/checkdoc-tests.el
(checkdoc-cl-defmethod-with-types-ok)
(checkdoc-cl-defmethod-qualified-ok)
(checkdoc-cl-defmethod-with-extra-qualifier-ok): Adhere to the new rule.
Phil Sainty [Sat, 16 Jan 2021 12:25:13 +0000 (01:25 +1300)]
Make `global-so-long-mode' use `buffer-line-statistics'
* lisp/so-long.el: (so-long-statistics-excessive-p): New predicate
function using `buffer-line-statistics'.
(so-long-predicate): Use `so-long-statistics-excessive-p' by default.
* etc/NEWS: Describe changes.
* test/lisp/so-long-tests/so-long-tests-helpers.el:
* test/lisp/so-long-tests/so-long-tests.el: Update tests.
Also improve the existing `so-long-tests-predicate' tests.
A more general solution to bug#45084 has been implemented via
new user options `so-long-mode-preserved-variables' and
`so-long-mode-preserved-minor-modes'.
See the previous commit (before this revert) for details.
Phil Sainty [Sun, 10 Jan 2021 02:02:58 +0000 (15:02 +1300)]
Support 'preserved' variables and minor modes in `so-long-mode'
The default values support preserving the state of `view-mode' when
switching to (and reverting from) `so-long-mode' (bug#45084).
* lisp/so-long.el (so-long-mode-preserved-variables)
(so-long-mode-preserved-minor-modes): New user options.
(so-long-mode-maintain-preserved-variables)
(so-long-mode-maintain-preserved-minor-modes): New functions.
(so-long-remember-all, so-long-after-change-major-mode)
(so-long-mode-revert): Use them.
Phil Sainty [Sat, 20 Mar 2021 08:48:18 +0000 (21:48 +1300)]
; so-long-tests.el: Suppress expected warnings
* test/lisp/so-long-tests/so-long-tests.el
(so-long-tests-invisible-buffer-function): Suppress warning about
obsolete function `run-window-configuration-change-hook', as we are
using it intentionally (see the preceding code comments and URL for
details).
Phil Sainty [Sun, 10 Jan 2021 02:20:51 +0000 (15:20 +1300)]
; * lisp/so-long.el: Minor bug fixes
(so-long-disable-minor-modes): Don't call the mode function to disable
the mode unless it was actually enabled.
(so-long-restore-minor-modes, so-long-restore-variables): Use the
remembered list values, which might be different to the defaults.
Also comments, and spelling consistency changes for the so-long tests
(a fixup for commit 83bc4ad369 which had only addressed so-long.el,
and not the test files).
This doesn't affect buffers which are simply in `fundamental-mode' by
default. It only affects buffers for which `set-auto-mode' has been
called (normally via `find-file') without establishing a different
major mode.
Phil Sainty [Sun, 10 Jan 2021 01:29:32 +0000 (14:29 +1300)]
Increase `so-long-threshold' and `so-long-max-lines' defaults
* lisp/so-long.el (so-long-threshold, so-long-max-lines): Increase
default values to reduce false-positives.
* etc/NEWS: Describe changes.
Lines shorter than 10,000 characters shouldn't generally be causing
problems, so testing this explicitly will largely eliminate
false-positives. We must also increase the maximum number of lines
to check, because 'minified' code may still include newlines, and so
there may be many lines shorter than the new threshold before we find
a line which exceeds it.
Previously we used a minimum-effort heuristic, testing a very small
number of lines against a maximum length which, while not remotely
long enough to cause problems, would nevertheless be uncommon in any
normal file of programming code (and hence indicative that the file
was likely to be minified code).
Testing indicates that the performance penalty for the larger values
should be negligible.
* Fix error while disassembling native code on macOS
* lisp/emacs-lisp/disass.el (disassemble-internal): Make sure the
regexp that searches for a symbol takes into account of llvm-objdump's
output format.
* lisp/erc/erc-ibuffer.el (erc-modified): Don't use `length' on dotted
lists (and not even to test if there is more than one element, for
that matter). Use `cdr' instead.
Stephen Gildea [Mon, 2 Aug 2021 04:00:37 +0000 (21:00 -0700)]
mh-junk: adjust messages for allow/block actions
* lisp/mh-e/mh-junk.el: Remove messages that get overwritten quickly.
Keep messages that give status for slow operations. Add information
that might be useful for debugging failures.
Stefan Monnier [Sun, 1 Aug 2021 22:13:41 +0000 (18:13 -0400)]
* lisp/mwheel.el: Don't use `custom-initialize-delay`.
Set up the keybindings when loading the file.
(mouse-wheel--installed-bindings-alist): Move to beginning.
(mouse-wheel-change-button): Don't update bindings when they're not installed.
(mouse-wheel--setup-bindings): New function extracted from `mouse-wheel-mode`.
(<topleve>): Call it when loading the file.
(mouse-wheel-mode): Use the default :initializer.
Change `dlet` so that it has binding semantics like `let` because that
is what a user would expect and it allows a corresponding `dlet*` to
be added later should the need arise. Fortunately the change has no
effect where it is currently used.
* lisp/subr.el (dlet): Work like let.
* lisp/calendar/cal-bahai.el (calendar-bahai-date-string):
* lisp/calendar/cal-coptic.el (calendar-coptic-date-string):
* lisp/calendar/cal-dst.el (calendar-time-zone-daylight-rules)
(calendar-dst-starts, dst-in-effect):
* lisp/calendar/cal-persia.el (calendar-persian-date-string):
* lisp/calendar/calendar.el (calendar-dlet, calendar-generate-month)
(calendar-update-mode-line, calendar-date-string):
* lisp/calendar/diary-lib.el (diary-list-entries-2)
(diary-list-entries, diary-mark-entries-1, diary-sexp-entry)
(diary-remind, diary-font-lock-date-forms, diary-fancy-date-pattern):
* lisp/calendar/holidays.el (holiday-sexp):
* lisp/calendar/icalendar.el (icalendar--convert-float-to-ical):
* lisp/calendar/solar.el (solar-time-string):
* lisp/calendar/todo-mode.el (todo-date-pattern)
(todo-edit-item--header, todo-convert-legacy-date-time)
(todo-read-date):
Rename `calendar-dlet*` to `calendar-dlet` since it uses `dlet`.
Juri Linkov [Sun, 1 Aug 2021 08:38:51 +0000 (11:38 +0300)]
* lisp/filecache.el: Fix cycling (bug#49761).
(file-cache-cycle): Refactor from file-cache-minibuffer-complete.
(file-cache-minibuffer-complete): Use file-cache-cycle in 2 old places,
and in 1 following new place. When last-command is equal to this-command,
use file-cache-cycle to continue cycling the previous completion
as long as the user continues typing C-TAB.
Also when displaying a list of completions, don't try to move point
to the common prefix.
When an occur-mode regexp matches across multiple lines, the spacing
prefixes inserted between each did not have the `occur-target`
property which is essential for jumping to the corresponding place in
the target buffer. This prevented next-error and previous-error
from working.
* lisp/replace.el (occur-engine): Put the `occur-target` property on
the continuation prefix to avoid the gap.
* lisp/help-mode.el (help-mode-map): Remove key bindings for RET
and <mouse-2> (bug#49784).
(help-xref-stack, help-xref-forward-stack, help-xref-stack-item)
(help-make-xrefs): Fix doc strings -- these aren't used by
`help-follow', but by `help-follow-symbol'.
(help-follow-mouse, help-follow): Make obsolete.
Alan Third [Wed, 23 Jun 2021 15:07:12 +0000 (16:07 +0100)]
Fix some macOS problems
* src/nsmenu.m (update_frame_tool_bar): Make sure the toolbar isn't
displayed when it's not supposed to be.
* src/nsterm.m ([EmacsView layoutSublayersOfLayer:]): Reinstate code
intended to prevent a crash when running redisplay.
Alan Third [Sat, 12 Jun 2021 18:04:02 +0000 (19:04 +0100)]
Move parent frame setting code into EmacsWindow
* src/nsterm.m (ns_make_frame_visible):
(ns_set_parent_frame):
([EmacsWindow initWithEmacsFrame:fullscreen:screen:]): Use new method.
([EmacsWindow setParentChildRelationships]): New method.
Alan Third [Sat, 12 Jun 2021 11:52:15 +0000 (12:52 +0100)]
Move NS port toolbar handling to the window
* src/nsmenu.m (free_frame_tool_bar):
(update_frame_tool_bar): Remove wait_for_tool_bar and get the toolbar
from the window.
* src/nsterm.h (EmacsView): Remove toolbar and wait_for_tool_bar.
* src/nsterm.m (ns_update_begin):
([EmacsView windowDidEnterFullScreen]):
([EmacsView windowDidExitFullScreen]): Get the toolbar from the
window, not the view.
([EmacsView dealloc]): Remove toolbar from view.
([EmacsView createToolbar:]): Move method to EmacsWindow.
([EmacsView initFrameFromEmacs:]): Don't create toolbar here any more.
([EmacsView toolbar]): Remove method.
([EmacsWindow initWithEmacsFrame:fullscreen:screen:]): Create toolbar here.
([EmacsWindow createToolbar:]): Moved from EmacsView.
([EmacsWindow dealloc]): Make sure we clean up the toolbar after
closing the window.
Alan Third [Wed, 9 Jun 2021 16:57:00 +0000 (17:57 +0100)]
Change NS port resize detection
* src/nsterm.m ([EmacsView windowDidResize:]): Remove function, it's
not performing a useful function any more.
([EmacsView viewDidResize]):
([EmacsView resizeWithOldSuperviewSize:]): Replace viewDidResize with
resizeWithOldSuperviewSize.
([EmacsView initFrameFromEmacs:]): Remove the view resize notification
as we don't need it any more.
Alan Third [Sat, 5 Jun 2021 11:39:46 +0000 (12:39 +0100)]
Tidy up NS port OS window handling
* src/nsterm.h (EmacsWindow): Move above EmacsView definition and add
new method definitions.
(EmacsView): Remove redundant bwidth variable, and change NSWindow to
EmacsWindow.
(EmacsFSWindow): Delete definition.
* src/nsterm.m (ns_set_undecorated): Rewrite to work in GNUstep using
the new OS window creating methods.
([EmacsView initFrameFromEmacs:]): Move all NSWindow related code to
new init method in EmacsWindow, and use said method.
([EmacsView toggleFullScreen:]): Use EmacsWindow instead of NSWindow.
([EmacsWindow initWithEmacsFrame:]):
([EmacsWindow initWithEmacsFrame:fullscreen:screen:]):
([EmacsWindow borderWidth]): New methods.
(EmacsFSWindow): Remove implementation.
Alan Third [Sat, 29 May 2021 08:48:51 +0000 (09:48 +0100)]
Simplify macOS drawing code
Convert EmacsSurface into a CALayer subclass so we can use the
built-in relationships. Also simplify the macOS versioning code.
This will result in more warnings on older versions of macOS but makes
reading the code easier.
* configure.ac: Add QuartzCore framework.
* src/nsterm.h (NS_DRAW_TO_BUFFER): Remove define and all references.
(EmacsSurface, EmacsLayer): Rename EmacsSurface to EmacsLayer and
modify the definition to fit the new function.
* src/nsterm.m (ns_update_begin):
(ns_update_end):
(ns_focus):
(ns_unfocus): Use the new overridden lockFocus and unlockFocus and
simplify the frame management.
([EmacsView dealloc]):
([EmacsView viewDidResize:]):Don't explicitly release surfaces.
([EmacsView initFrameFromEmacs:]): Move the layer code to after the
NSWindow has been created as creating the layer now relies on some of
it's properties.
([EmacsView makeBackingLayer]): New function.
([EmacsView lockFocus]):
([EmacsView focusOnDrawingBuffer]): Rename to lockFocus.
([EmacsView unlockFocus]):
([EmacsView unfocusDrawingBuffer]): Rename to unlockFocus.
([EmacsView windowDidChangeBackingProperties]): Don't explicitly
release surfaces but reset EmacsLayer properties.
([EmacsView layout]):
([EmacsView viewWillDraw]): Rename to layout.
([EmacsView wantsUpdateLayer]): Remove function and change all callers
to [EmacsView wantsLayer].
(EmacsSurface, EmacsLayer): Rename to EmacsLayer.
([EmacsSurface getSize]):
([EmacsSurface initWithSize:ColorSpace:Scale:]): Remove methods.
([EmacsSurface initWithColorSpace:]):
([EmacsLayer checkDimensions]):
([EmacsLayer releaseSurfaces]):
([EmacsLayer display]): New functions.
* src/nsterm.m ([EmacsLayer dealloc]): Use releaseSurfaces.
([EmacsSurface getContext]): Automatically detect frame property
changes and clear the cache if required. Use built-in CALayer
properties where available.
([EmacsLayer copyContentsTo:]): Use [CALayer contents] as source.
Ensure in cconv that let-bindings have the normal form (VAR EXPR)
where VAR is a valid variable name, so that we don't need to keep
re-checking this all the time in the optimiser.
* lisp/emacs-lisp/byte-opt.el
(byte-optimize-enable-variable-constprop)
(byte-optimize-warn-eliminated-variable): Remove; these were mainly
used for debugging.
* lisp/emacs-lisp/byte-opt.el (byte-optimize-let-form):
Assume normalised let-bindings (with lexical-binding).
Stop using the variables removed above.
* lisp/emacs-lisp/cconv.el (cconv-convert): Ensure normalised
let-bindings. Malformed bindings are dropped after warning.
Max Nikulin [Fri, 30 Jul 2021 12:00:41 +0000 (14:00 +0200)]
mailcap.el: Avoid xdg-open silent failure
* lisp/net/mailcap.el (mailcap-view-file): Use 'pipe :connection-type
instead of 'pty to prevent killing of background process on handler
exit. Avoid regression similar to Bug#44824.
Problem happens only in some desktop environments where mailcap handler
launches actual viewer (as defined in .desktop files and obtained from
mimeapps.list) in background. E.g. xdg-open invokes "gio open" or
kde-open5 for Gnome or KDE accordingly and these handlers launch e.g.
eog or okular in background. As soon as main process exits, temporary
terminal session created by `start-process-shell-command' is terminated.
As a result background processes receive SIGHUP.
Previously command were executed with no buffer as well, so the change
does not affect "needsterminal" and "copiousoutput" mailcap features,
they are not supported as earlier.
If main process of the handler fails then show a message with exit
reason. Output (including error messages) is ignored as before.
Gtk applications tend to report significant amount of failed asserts
hardly informative for majority of users (bug#12972).
Work around long-standing seq.el compilation warning
* lisp/emacs-lisp/seq.el (seq-contains): When using cl-defgeneric
to define an obsolete function, it'll complain about it being
obsolete. Suppress that warning. (Should probably be fixed in
cl-defgeneric instead.)
Recent optimizer changes revealed a case-fold-search binding in
Ispell that was made redundant in the revision of 2020-11-03
"Simplify ispell-check-version’s use of -vv flag".
* lisp/textmodes/ispell.el (ispell-check-version): Remove no-op
binding of case-fold-search.
Michael Albinus [Fri, 30 Jul 2021 09:57:39 +0000 (11:57 +0200)]
Fix bug#49773 in Tramp
* lisp/net/tramp.el (tramp-handle-find-backup-file-name)
(tramp-handle-lock-file, tramp-handle-make-auto-save-file-name):
Check security hole only if action is in progress. (Bug#49773)
and similarly the case where the body is a constant, extending a
previous optimisation that only applied to the constant nil.
This reduces the number of bound variables, shortens the code, and
enables further optimisations.
* lisp/emacs-lisp/byte-opt.el (byte-optimize-letX): Rewrite using
`pcase` and add the aforementioned transformations.
* test/lisp/emacs-lisp/bytecomp-tests.el (bytecomp-tests--test-cases):
Add test cases.
Move warnings about bad let-bindings from source optimiser to cconv
* lisp/emacs-lisp/byte-opt.el (byte-optimize-let-form): Move warnings...
* lisp/emacs-lisp/cconv.el (cconv-convert): ...here, which is an
overall better place (closer to the front-end).
Rewrite (prog1 CONST FORMS...) => (progn FORMS... CONST)
where CONST is a compile-time constant, because putting the value last
allows the lapcode peephole pass to do important improvements like
branch elimination. Also use progn instead of prog1 for `ignore`.
* lisp/emacs-lisp/byte-opt.el (byte-optimize-form-code-walker):
New `prog1` and `ignore` transforms.
Elide lexical variables in for-effect context in source optimiser
* lisp/emacs-lisp/byte-opt.el (byte-optimize-form-code-walker):
Remove for-effect uses of lexical variables. We previously relied on
this being done by the lapcode peephole optimiser but at source level
it enables more optimisation opportunities.
Keywords are elided for the same reason.
Make the optimiser aware of lexical arguments. Otherwise we cannot
know for sure whether a variable is lexical or dynamic during
traversal.
* lisp/emacs-lisp/byte-opt.el (byte-optimize-one-form): New optimiser
entry point, replacing the recursive byte-optimize-form.
* lisp/emacs-lisp/bytecomp.el (byte-optimize-one-form): Autoload.
(byte-compile-keep-pending, byte-compile-top-level):
Use byte-optimize-one-form.