Skip to content

Instantly share code, notes, and snippets.

@informationsea
Created April 13, 2015 10:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save informationsea/35ebf06ec612d93fc91d to your computer and use it in GitHub Desktop.
Save informationsea/35ebf06ec612d93fc91d to your computer and use it in GitHub Desktop.
Emacs 24.5 Japanese-English patch
diff --git a/configure.ac b/configure.ac
index 4291453..1ed10b6 100644
--- a/configure.ac
+++ b/configure.ac
@@ -4876,7 +4876,7 @@ case "$opsys" in
## only costs about 1.5K of wasted binary space.
headerpad_extra=1000
if test "$HAVE_NS" = "yes"; then
- libs_nsgui="-framework AppKit"
+ libs_nsgui="-framework AppKit -framework Carbon"
if test "$NS_IMPL_COCOA" = "yes"; then
libs_nsgui="$libs_nsgui -framework IOKit"
fi
diff --git a/lisp/term/ns-win.el b/lisp/term/ns-win.el
index fbaee2a..313c2b9 100644
--- a/lisp/term/ns-win.el
+++ b/lisp/term/ns-win.el
@@ -574,6 +574,15 @@ the last file dropped is selected."
(interactive)
(ns-hide-others))
+(declare-function ns-inputmethod-change "nsfns.m" ())
+(defun ns-inputmethod-change-us ()
+ (interactive)
+ (ns-inputmethod-change nil))
+(defun ns-inputmethod-change-jp ()
+ (interactive)
+ (ns-inputmethod-change t))
+
+
(declare-function ns-emacs-info-panel "nsfns.m" ())
(defun ns-do-emacs-info-panel ()
diff --git a/src/nsfns.m b/src/nsfns.m
index 33d63a6..a7f7262 100644
--- a/src/nsfns.m
+++ b/src/nsfns.m
@@ -33,6 +33,8 @@ GNUstep port and post-20 update by Adrian Robert (arobert@cogsci.ucsd.edu)
#include <math.h>
#include <c-strcase.h>
+#include <Carbon/Carbon.h>
+
#include "lisp.h"
#include "blockinput.h"
#include "nsterm.h"
@@ -2925,6 +2927,29 @@ handlePanelKeys (NSSavePanel *panel, NSEvent *theEvent)
}
@end
+
+DEFUN ("ns-inputmethod-change", Fns_inputmethod_change, Sns_inputmethod_change,
+ 1, 1, 0,
+ doc: /* inputmethod on/off */)
+ (Lisp_Object arg)
+{
+
+ TISInputSourceRef is = NULL;
+
+ if (NILP (arg))
+ {
+ is = TISCopyCurrentASCIICapableKeyboardInputSource();
+ }
+ else
+ {
+ NSString *locale = [[NSLocale currentLocale] localeIdentifier];
+ is = TISCopyInputSourceForLanguage(locale);
+ }
+ if (is) TISSelectInputSource(is);
+
+ return arg;
+}
+
#endif
@@ -2975,6 +3000,7 @@ be used as the image of the icon representing the frame. */);
defsubr (&Sns_list_colors);
#ifdef NS_IMPL_COCOA
defsubr (&Sns_do_applescript);
+ defsubr (&Sns_inputmethod_change);
#endif
defsubr (&Sxw_color_defined_p);
defsubr (&Sxw_color_values);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment