aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlvaro Ramirez2025-07-21 12:53:50 +0100
committerGerd Möllmann2025-07-26 12:09:56 +0200
commit6e64e0bd26b6c0f1c4e90c9bc0df37a2a9ac72da (patch)
tree4068f5177529f458c707311ef513e8c9dcbc5155
parente0152180570b3a071c3fb9140aa94b23e4e93857 (diff)
downloademacs-6e64e0bd26b6c0f1c4e90c9bc0df37a2a9ac72da.tar.gz
emacs-6e64e0bd26b6c0f1c4e90c9bc0df37a2a9ac72da.zip
Enabled macOS dictation post NSTextInputClient migration in v30
* src/nsterm.m (selectedRange): Implement to fix dictation. * etc/NEWS: Announce regression fix. * etc/PROBLEMS: Help users recover from rejected permission.
-rw-r--r--etc/NEWS6
-rw-r--r--etc/PROBLEMS12
-rw-r--r--src/nsterm.m19
3 files changed, 36 insertions, 1 deletions
diff --git a/etc/NEWS b/etc/NEWS
index c38dd6a4654..5ca0642b615 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -2832,6 +2832,12 @@ allowing Emacs users access to speech recognition utilities.
2832Note: Accepting this permission allows the use of system APIs, which may 2832Note: Accepting this permission allows the use of system APIs, which may
2833send user data to Apple's speech recognition servers. 2833send user data to Apple's speech recognition servers.
2834 2834
2835---
2836** Re-introduced dictation, lost in Emacs v30 (macOS).
2837We lost macOS dictation in v30 when migrating to NSTextInputClient.
2838Implemented 'selectedRange' in 'nsterm.m' to enable in new subsystem.
2839You may notice a slight change in dictation UI provided by macOS.
2840
2835+++ 2841+++
2836** On Mac OS X, stipples now render with color. 2842** On Mac OS X, stipples now render with color.
2837 2843
diff --git a/etc/PROBLEMS b/etc/PROBLEMS
index 20fe9134da5..2d0a5870be9 100644
--- a/etc/PROBLEMS
+++ b/etc/PROBLEMS
@@ -3566,6 +3566,18 @@ file; for example:
3566 "/usr/local/opt/libgccjit/lib/gcc/11" 3566 "/usr/local/opt/libgccjit/lib/gcc/11"
3567 "/usr/local/opt/gcc/lib/gcc/11/gcc/x86_64-apple-darwin20/11.2.0") ":")) 3567 "/usr/local/opt/gcc/lib/gcc/11/gcc/x86_64-apple-darwin20/11.2.0") ":"))
3568 3568
3569** Text dictation doesn't work on macOS
3570
3571The indication is that the macOS keyboard shortcut for dictation is ignored.
3572
3573One reason for this is that the Emacs permissions for using the
3574microphone were rejected in the past. To reset the permissions, run
3575this command:
3576
3577 tccutil reset Microphone org.gnu.Emacs
3578
3579Another reason may be an unsupported macOS version. For example: macOS 12.
3580
3569* Runtime problems specific to PGTK build 3581* Runtime problems specific to PGTK build
3570 3582
3571** Whether a display server is available cannot be automatically detected. 3583** Whether a display server is available cannot be automatically detected.
diff --git a/src/nsterm.m b/src/nsterm.m
index 14f47973e54..5b4067d3a0d 100644
--- a/src/nsterm.m
+++ b/src/nsterm.m
@@ -7413,7 +7413,24 @@ ns_in_echo_area (void)
7413{ 7413{
7414 if (NS_KEYLOG) 7414 if (NS_KEYLOG)
7415 NSLog (@"selectedRange request"); 7415 NSLog (@"selectedRange request");
7416 return NSMakeRange (NSNotFound, 0); 7416
7417 struct window *w = XWINDOW (FRAME_SELECTED_WINDOW (emacsframe));
7418 struct buffer *buf = XBUFFER (w->contents);
7419 ptrdiff_t point = BUF_PT (buf);
7420
7421 if (NILP (BVAR (buf, mark_active)))
7422 {
7423 NSUInteger selection_location = point - BUF_BEGV (buf);
7424 return NSMakeRange (selection_location, 0);
7425 }
7426
7427 ptrdiff_t mark = marker_position (BVAR (buf, mark));
7428 ptrdiff_t region_start = min (point, mark);
7429 ptrdiff_t region_end = max (point, mark);
7430 NSUInteger selection_location = region_start - BUF_BEGV (buf);
7431 NSUInteger selection_length = region_end - region_start;
7432
7433 return NSMakeRange (selection_location, selection_length);
7417} 7434}
7418 7435
7419#if defined (NS_IMPL_COCOA) || GNUSTEP_GUI_MAJOR_VERSION > 0 || \ 7436#if defined (NS_IMPL_COCOA) || GNUSTEP_GUI_MAJOR_VERSION > 0 || \