all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "Jan Djärv" <jan.h.d@swipnet.se>
To: YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
Cc: Charles Magid <cmmagid@gmail.com>, 11134@debbugs.gnu.org
Subject: bug#11134: 24.0.94; Mac's Text to Speech stopped working in emacs buffers when I moved	from Snow Leopard to Lion
Date: Sat, 31 Mar 2012 16:34:56 +0200	[thread overview]
Message-ID: <8DA592B4-297B-4713-95D4-B53C9269EA6A@swipnet.se> (raw)
In-Reply-To: <wliphltws6.wl%mituharu@math.s.chiba-u.ac.jp>


31 mar 2012 kl. 02:54 skrev YAMAMOTO Mitsuharu:

>>>>>> On Fri, 30 Mar 2012 14:09:45 -0400, Charles Magid <cmmagid@gmail.com> said:
> 
>> 1. On Mac OS X Lion go into system preferences.
>> 2. Click on speach
>> 3. Click on text to speech
>> 4. Check Speak selected text when key is pressed
>> 5. click on change key button and select the button you want to use. I
>> use <Alt-'>
>> 6. Got to emacs and Highlight some text in a buffer
>> 7. press the speech key combo for me <Alt-'>
>> 8. The name of the buffer is spoken not the highlighted text.
> 
>> This worked properly in Snow Leapard.
> 
> Lion's "text to speech" seems to use accessibility that the NS port
> doesn't support yet, and that would explain why the name of the buffer
> is spoken.  If you try the Mac port (*) that has experimental
> accessibility support, the selected text will be spoken (and buffer
> text if no selection).
> 
> 

The NS port does not support accessability at all, but if it is the function described by YAMAMOTO Mitsuharu above you want, try the patch below.  As we are in feature freeze, a proper checkin will have to wait.

	Jan D.


=== modified file 'src/nsterm.m'
--- src/nsterm.m        2012-02-04 15:10:54 +0000
+++ src/nsterm.m        2012-03-31 14:25:59 +0000
@@ -6034,6 +6034,46 @@
 
 @implementation EmacsWindow
 
+- (id)accessibilityAttributeValue:(NSString *)attribute
+{
+  Lisp_Object str = Qnil;
+
+  if ([attribute isEqualToString:NSAccessibilityRoleAttribute])
+    return NSAccessibilityTextFieldRole;
+
+  if ([attribute isEqualToString:NSAccessibilitySelectedTextAttribute] &&
+      ! NILP (BVAR (current_buffer, mark_active)))
+    {
+      str = ns_get_local_selection (QPRIMARY, QUTF8_STRING);
+    }
+  else if ([attribute isEqualToString:NSAccessibilityValueAttribute])
+    {
+      if (! NILP (BVAR (current_buffer, mark_active)))
+        str = ns_get_local_selection (QPRIMARY, QUTF8_STRING);
+      if (NILP (str))
+        str = Fbuffer_string ();
+    }
+  
+  
+  if (! NILP (str)) 
+    {
+      if (CONSP (str) && SYMBOLP (XCAR (str)))
+        {
+          str = XCDR (str);
+          if (CONSP (str) && NILP (XCDR (str)))
+            str = XCAR (str);
+        }
+      if (STRINGP (str))
+        {
+          char *utfStr = SSDATA (str);
+          NSString *nsStr = [NSString stringWithUTF8String: utfStr];
+          return nsStr;
+        }
+    }
+  
+  return [super accessibilityAttributeValue:attribute];
+}
+
 /* If we have multiple monitors, one above the other, we don't want to
    restrict the height to just one monitor.  So we override this.  */
 - (NSRect)constrainFrameRect:(NSRect)frameRect toScreen:(NSScreen *)screen







  parent reply	other threads:[~2012-03-31 14:34 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-03-30 18:09 bug#11134: 24.0.94; Mac's Text to Speech stopped working in emacs buffers when I moved from Snow Leopard to Lion Charles Magid
2012-03-31  0:54 ` YAMAMOTO Mitsuharu
2012-03-31  5:44   ` Eli Zaretskii
2012-03-31 14:34   ` Jan Djärv [this message]
2012-04-01  3:09     ` YAMAMOTO Mitsuharu
2012-04-01  9:10       ` Jan Djärv
2012-04-01 22:50         ` YAMAMOTO Mitsuharu
2012-04-01 13:26       ` Stefan Monnier
2012-07-21 11:23 ` Jan Djärv

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8DA592B4-297B-4713-95D4-B53C9269EA6A@swipnet.se \
    --to=jan.h.d@swipnet.se \
    --cc=11134@debbugs.gnu.org \
    --cc=cmmagid@gmail.com \
    --cc=mituharu@math.s.chiba-u.ac.jp \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.