GNU bug report logs - #5330
Term mode in Cocoa does not respect NS-ALTERNATE-MODIFIER

Previous Next

Package: emacs;

Reported by: Scott Bell <sctb <at> me.com>

Date: Wed, 6 Jan 2010 23:57:02 UTC

Severity: normal

Tags: fixed

Merged with 5449

Fixed in version 24.1

Done: Lars Magne Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Ken Hori <fplemma <at> gmail.com>
To: Scott Bell <sctb <at> me.com>
Cc: 5330 <at> debbugs.gnu.org
Subject: bug#5330: Term mode in Cocoa does not respect  NS-ALTERNATE-MODIFIER
Date: Mon, 18 Jan 2010 13:17:28 -0800
[Message part 1 (text/plain, inline)]
Please ignore my last post.

You can instead apply the following patch for a quick fix:

+++ term.el    2010-01-18 09:27:33.085376730 -0800
@@ -1208,8 +1208,17 @@

 (defun term-send-raw-meta ()
   (interactive)
-  (let* ((keys (this-command-keys))
-         (char (aref keys (1- (length keys)))))
+  (let ((char last-input-event))
+    (when (symbolp last-input-event)
+      ;; Convert `return' to C-m, etc.
+      (let ((tmp (get char 'event-symbol-elements)))
+    (when tmp
+      (setq char (car tmp)))
+    (when (symbolp char)
+      (setq tmp (get char 'ascii-character))
+      (when tmp
+        (setq char tmp)))))
+    (setq char (event-basic-type char))
     (term-send-raw-string (if (and (numberp char)
                    (> char 127)
                    (< char 256))

Or, just replace your term-send-raw-meta with:

(defun term-send-raw-meta ()
  (interactive)
  (let ((char last-input-event))
    (when (symbolp last-input-event)
      ;; Convert `return' to C-m, etc.
      (let ((tmp (get char 'event-symbol-elements)))
    (when tmp
      (setq char (car tmp)))
    (when (symbolp char)
      (setq tmp (get char 'ascii-character))
      (when tmp
        (setq char tmp)))))
    (setq char (event-basic-type char))
    (term-send-raw-string (if (and (numberp char)
                   (> char 127)
                   (< char 256))
                  (make-string 1 char)
                (format "\e%c" char)))))

Let me know if it succeeds or not.

On Sun, Jan 17, 2010 at 3:46 PM, Scott Bell <sctb <at> me.com> wrote:

> On 2010-01-17, at 7:18 AM, Ken Hori wrote:
>
> > I identified the cause of this bug.
> >
> > It happens when PS1 environment variable contains certain \e escape code
> > like '\[\e[01;32m\][\h:\w]\$\[\e[00m\] '.
>
> I can't reproduce this -- I still encounter the problem
> when PS1='> ' (no escape codes).
>
>
>
>
>
>
[Message part 2 (text/html, inline)]

This bug report was last modified 13 years and 246 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.