diff --git a/doc/lispintro/emacs-lisp-intro.texi b/doc/lispintro/emacs-lisp-intro.texi index 0211a4b3686..41ccfc11cba 100644 --- a/doc/lispintro/emacs-lisp-intro.texi +++ b/doc/lispintro/emacs-lisp-intro.texi @@ -16979,11 +16979,10 @@ The command invoked by the keys is @code{compare-windows}. Note that @code{compare-windows} is preceded by a single-quote; otherwise, Emacs would first try to evaluate the symbol to determine its value. -These three things, the double quotation marks, the backslash before -the @samp{C}, and the single-quote are necessary parts of -key binding that I tend to forget. Fortunately, I have come to -remember that I should look at my existing @file{.emacs} file, and -adapt what is there. +These two things, the double quotation marks and the single-quote, are +necessary parts of key binding that I tend to forget. Fortunately, I +have come to remember that I should look at my existing @file{.emacs} +file, and adapt what is there. As for the key binding itself: @kbd{C-c w}. This combines the prefix key, @kbd{C-c}, with a single character, in this case, @kbd{w}. This diff --git a/etc/NEWS b/etc/NEWS index 90dbca7501b..3639d1b47e8 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -4520,9 +4520,17 @@ singleton list. --- ** Support macOS Accessibility Zoom focus tracking. This is an important change for visually-impaired users. If macOS -Accessibility Zoom is enabled (System Settings, Accessibility, Zoom) -with keyboard focus tracking (Advanced...), Zoom is informed of updated -cursor positions during each redisplay cycle. +Accessibility Zoom is enabled via (System Settings, Accessibility, +Zoom...) with keyboard focus tracking (Advanced...), Zoom is informed +of updated cursor positions during each redisplay cycle. + +--- +** New macOS function 'ns-process-is-accessibility-trusted'. +This function returns t if the macOS Accessibility Framework trusts the +Emacs. This is a necessary condition for Accessibility Zoom and other +accessibility features. Enable Emacs via (System Settings, Privacy & +Security, Accessibility...) and add the Emacs.app installed directory to +the enabled application list. --- ** Process execution has been optimized on Android. diff --git a/lisp/progmodes/elisp-mode.el b/lisp/progmodes/elisp-mode.el index 3c3aafcde15..cf380ada975 100644 --- a/lisp/progmodes/elisp-mode.el +++ b/lisp/progmodes/elisp-mode.el @@ -774,7 +774,9 @@ be used instead. ;; be any need to font-lock-flush all the Elisp buffers. (dolist (buf (buffer-list)) (with-current-buffer buf - (when (derived-mode-p 'emacs-lisp-mode) + (when (and (derived-mode-p 'emacs-lisp-mode) + ;; Don't flush if it refontifies the whole buffer eagerly. + font-lock-support-mode) ;; So as to take into account new macros that may have been defined ;; by the just-loaded file. (font-lock-flush)))))) @@ -868,29 +870,30 @@ use of `macroexpand-all' as a way to find the \"underlying raw code\".") (defun elisp--local-variables () "Return a list of locally let-bound variables at point." - (save-excursion - (skip-syntax-backward "w_") - (let* ((ppss (syntax-ppss)) - (txt (buffer-substring-no-properties (or (car (nth 9 ppss)) (point)) - (or (nth 8 ppss) (point)))) - (closer ())) - (dolist (p (nth 9 ppss)) - (push (cdr (syntax-after p)) closer)) - (setq closer (apply #'string closer)) - (let* ((sexp (condition-case nil - (car (read-from-string - (concat txt "elisp--witness--lisp" closer))) - ((invalid-read-syntax end-of-file) nil))) - (vars (elisp--local-variables-1 - nil (elisp--safe-macroexpand-all sexp)))) - (delq nil - (mapcar (lambda (var) - (and (symbolp var) - (not (string-match (symbol-name var) "\\`[&_]")) - ;; Eliminate uninterned vars. - (intern-soft var) - var)) - vars)))))) + (let* ((sexp + (save-excursion + (skip-syntax-backward "w_") + (let* ((ppss (syntax-ppss)) + (txt (buffer-substring-no-properties + (or (car (nth 9 ppss)) (point)) + (or (nth 8 ppss) (point)))) + (closer + (nreverse (mapcar (lambda (p) (cdr (syntax-after p))) + (nth 9 ppss))))) + (condition-case nil + (car (read-from-string + (concat txt "elisp--witness--lisp" closer))) + ((invalid-read-syntax end-of-file) nil))))) + (vars (elisp--local-variables-1 + nil (elisp--safe-macroexpand-all sexp)))) + (delq nil + (mapcar (lambda (var) + (and (symbolp var) + (not (string-match (symbol-name var) "\\`[&_]")) + ;; Eliminate uninterned vars. + (intern-soft var) + var)) + vars)))) (defconst elisp--local-variables-completion-table (let ((lastpos nil) (lastvars nil)) diff --git a/lisp/subr.el b/lisp/subr.el index 682e156de12..036f414262a 100644 --- a/lisp/subr.el +++ b/lisp/subr.el @@ -1806,7 +1806,7 @@ See also `current-global-map'.") (defun listify-key-sequence (key) "Convert a key sequence to a list of events." (declare (side-effect-free t)) - (if (vectorp key) + (if (or (vectorp key) (multibyte-string-p key)) (append key nil) (mapcar (lambda (c) (if (> c 127) diff --git a/lisp/vc/vc.el b/lisp/vc/vc.el index c1e373d496b..3773973eb60 100644 --- a/lisp/vc/vc.el +++ b/lisp/vc/vc.el @@ -1276,7 +1276,7 @@ Return the result of evaluating FORM." (dolist (file ,flist) (dolist (setting ,settings) (let ((property (car setting))) - (unless (memq property ,vc-touched-properties) + (unless (memq property vc-touched-properties) (put (intern file vc-file-prop-obarray) property (cdr setting)))))))))) @@ -2230,7 +2230,8 @@ have changed; continue with old fileset?" (current-buffer)))) (dolist (file files) (let ((file (expand-file-name file))) (vc-file-setprop file 'display-state "committing") - (vc-dir-resynch-file file) + (when vc-dir-buffers + (vc-dir-resynch-file file)) (push file to-remove-props))) (vc-exec-after #'remove-props-done-msg nil proc)) ret) diff --git a/src/nsfns.m b/src/nsfns.m index ae8e6e30e66..efe622782f7 100644 --- a/src/nsfns.m +++ b/src/nsfns.m @@ -3755,6 +3755,27 @@ The position is returned as a cons cell (X . Y) of the return Qnil; } + +DEFUN ("ns-process-is-accessibility-trusted", + Fns_process_is_accessibility_trusted, + Sns_process_is_accessibility_trusted, + 0, 0, 0, + doc: /* Return non-nil if Emacs is trusted by macOS Accessibility. +Return nil otherwise or if the OS is not macOS. +This is necessary for Emacs to support Zoom and related accessibility +features. Authorize Emacs for accessibility via System +Settings... Privacy & Security... Accessibility... and add the Emacs.app +installed directory to the enabled application list. */) + (void) +{ +#ifdef NS_IMPL_COCOA + if (AXIsProcessTrusted()) + return Qt; +#endif + return Qnil; +} + + DEFUN ("ns-badge", Fns_badge, Sns_badge, 1, 1, 0, doc: /* Set the app icon badge to BADGE. BADGE should be a string short enough to display nicely in the short @@ -4248,6 +4269,7 @@ - (Lisp_Object)lispString defsubr (&Sns_set_mouse_absolute_pixel_position); defsubr (&Sns_mouse_absolute_pixel_position); defsubr (&Sns_show_character_palette); + defsubr (&Sns_process_is_accessibility_trusted); defsubr (&Sns_badge); defsubr (&Sns_request_user_attention); defsubr (&Sns_progress_indicator); diff --git a/src/nsterm.m b/src/nsterm.m index b16d020ebad..0dbb59344a3 100644 --- a/src/nsterm.m +++ b/src/nsterm.m @@ -6517,14 +6517,6 @@ - (void)applicationDidFinishLaunching: (NSNotification *)notification } #endif -#ifdef NS_IMPL_COCOA - /* Is accessibility enabled for this process/bundle? */ - if (AXIsProcessTrusted()) - NSLog (@"Emacs is macOS AXIsProcessTrusted"); - else - NSLog (@"Emacs is not macOS AXIsProcessTrusted"); -#endif - ns_send_appdefined (-2); } diff --git a/test/lisp/subr-tests.el b/test/lisp/subr-tests.el index 791b06f9edf..b99328459d6 100644 --- a/test/lisp/subr-tests.el +++ b/test/lisp/subr-tests.el @@ -433,6 +433,9 @@ (should (eq (global-key-binding "x") 'self-insert-command)) (should-not (global-key-binding [f12]))) +(ert-deftest subr-listify-key-sequence () + (should (equal (listify-key-sequence "ŕ°") '(?ŕ ?°)))) + ;;;; Mode hooks.