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.
Stephen Gildea [Fri, 30 Jul 2021 00:37:39 +0000 (17:37 -0700)]
mh-junk: replace color-based terms with descriptive words
* lisp/mh-e/*.el: "whitelist" -> "allowlist" and "blacklist" -> "blocklist".
* doc/misc/mh-e.texi: update manual to match.
* lisp/mh-e/folder.el: Change the binding of 'mh-junk-allowlist' to 'J a'.
Add a compatibility binding for the old 'J w'.
* lisp/mh-e/mh-scan.el (mh-note-allowlisted): Change char from 'W' to 'A'.
* lisp/mh-e/junk.el: Rename 'mh-blacklist-a-msg' to 'mh-junk-blocklist-a-msg',
adding the missing "junk-" to the function name.
Rename Gnus -unsubscribe-group commands to -toggle-subscription
* doc/emacs/misc.texi (Gnus Group Buffer): Document change.
* doc/misc/gnus.texi (Subscription Commands): Document change.
(Browse Foreign Server): Document change.
* lisp/gnus/gnus-group.el (gnus-group-mode-map):
Unsubscribe is not subscribe.
(gnus-group-sub-map): Unsubscribe is not subscribe.
(gnus-group-make-menu-bar): Unsubscribe is not subscribe.
(gnus-group-tool-bar-gnome): Unsubscribe is not subscribe.
(gnus-group-mode): Unsubscribe is not subscribe.
(gnus-group-unsubscribe): Refactor.
(gnus-group-subscribe): Refactor.
(gnus-group-unsubscribe-current-group): Define obsolete alias.
(gnus-group-unsubscribe-group): Define obsolete alias.
(gnus-group-toggle-subscription-at-point): Refactor.
(gnus-group-set-subscription-at-point): Refactor.
(gnus-group-toggle-subscription): Refactor.
(gnus-group-set-subscription): Refactor.
* lisp/gnus/gnus-srvr.el (gnus-browse-mode-map):
Unsubscribe is not subscribe.
(gnus-browse-make-menu-bar): Unsubscribe is not subscribe.
(gnus-browse-mode): Document the change.
(gnus-browse-unsubscribe-current-group): Define obsolete alias.
(gnus-browse-unsubscribe-group): Define obsolete alias.
(gnus-browse-toggle-subscription-at-point): Unsubscribe is not subscribe.
(gnus-browse-toggle-subscription): Unsubscribe is not subscribe
(bug#49759).
* lisp/bindings.el (mode-line-position-column-format): Improve doc
string.
(mode-line-position-line-format): Point to
`mode-line-position-column-line-format'.
Brian Leung [Tue, 20 Jul 2021 07:32:34 +0000 (00:32 -0700)]
Ensure that gud commands for non-GDB debuggers are handled by repeat-mode
* lisp/progmodes/gud.el (sdb-repeat-map): Define.
(sdb): Set repeat-mode property to the symbol corresponding to the
repeat map.
(dbx-repeat-map): Define.
(dbx): Set repeat-mode property to the symbol corresponding to the
repeat map.
(xdb-repeat-map): Define.
(xdb): Set repeat-mode property to the symbol corresponding to the
repeat map.
(perldb-repeat-map): Define.
(perldb): Set repeat-mode property to the symbol corresponding to the
repeat map.
(pdb-repeat-map): Define.
(pdb): Set repeat-mode property to the symbol corresponding to the
repeat map.
(guiler-repeat-map): Define.
(guiler): Set repeat-mode property to the symbol corresponding to the
repeat map.
(jdb-repeat-map): Define.
(jdb): Set repeat-mode property to the symbol corresponding to the
repeat map. (Bug#49632)
Brian Leung [Tue, 20 Jul 2021 06:41:01 +0000 (23:41 -0700)]
Ensure that gud commands for M-x gdb are handled by repeat-mode
* lisp/progmodes/gud.el (gud-gdb-repeat-map): Rename from
gud-repeat-map, and populate at the top-level.
(gud-set-repeat-map-property): Introduce this helper function for
setting the repeat-map property.
(gud-gdb): Use the gud-set-repeat-map-property function to assign the
repeat-map property.
* lisp/progmodes/gdb-mi.el (gdb): Use the gud-set-repeat-map-property
function to assign the repeat-map property.
Because different debugging tools may not support all of the gud-foo
functions, we reassign the repeat-map property within the respective
commands, as opposed to the top level of the files, to ensure that the
repeat-map property is reassigned each time to a symbol corresponding
to the active debugging tool. (Bug#49632)
Fix mistake in switch-case generation of `null` (bug#49746)
Reported by Gregor Zattler.
* lisp/emacs-lisp/bytecomp.el (byte-compile--cond-switch-prefix):
Be more careful in the selection of equality.
* test/lisp/emacs-lisp/bytecomp-tests.el (bytecomp-tests--test-cases):
Add test case.
Alan Third [Sat, 24 Jul 2021 15:08:09 +0000 (16:08 +0100)]
Convert fringe bitmaps to vectors on NS port
Unfortunately *step doesn't support masks for bitmap images so
changing the colors of fringe bitmaps is awkward. We can work around
this by converting the bitmap into an NSBezierPath and drawing it in
the required color.
* src/nsterm.m (ns_define_fringe_bitmap):
(ns_destroy_fringe_bitmap): New functions
(ns_draw_fringe_bitmap): Display the NSBezierPath.
* src/nsimage.m
([EmacsImage initFromXBM:width:height:fg:bg:reverseBytes:]): Remove
variable that's there to allow us to easily modify the XBM colors.
([EmacsImage setXBMColor:]): Remove method.
Alan Third [Sat, 17 Jul 2021 10:23:42 +0000 (11:23 +0100)]
Simplify NS sizing and positioning code
* src/nsterm.m (ns_set_offset): Unify the two branches into one, most
of the code is the same.
(ns_set_window_size): Use the provided tools to calculate the window
size instead of doing it ourselves.
* lisp/progmodes/grep.el (grep-regexp-alist): Adjust the return value
from the END-COL function by one since it is now (after fixing
bug#49624) inclusive. Found by Juri Linkov.
Michael Albinus [Mon, 26 Jul 2021 18:51:57 +0000 (20:51 +0200)]
Some minor improvements for share handling in tramp-gvfs.el
* lisp/net/tramp-gvfs.el (tramp-gvfs-connection-mounted-p):
Set "share" connection property if the mount spec offers it.
(tramp-gvfs-handle-get-remote-uid)
(tramp-gvfs-handle-get-remote-gid): Use it.