From bug-request at octave dot org Tue Nov 22 21:59:02 2005 Subject: octave-mod.el: wrong binding for M-BS in XEmacs From: "John W. Eaton" To: Rafael Laboissiere Cc: bug at octave dot org Date: Tue, 22 Nov 2005 22:47:25 -0500 On 22-Nov-2005, Rafael Laboissiere wrote: | Bug report for Octave 2.9.4 configured for i486-pc-linux-gnu | | [N.B. : this report also regards the 2.1 branch, but the patch below only | applies to the 2.9.4 sources.] | | Description: | ----------- | | The octave mode for XEmacs wrongly binding meta-backspace to | octave-mark-defun. This key sequence is normally bound to | backward-kill-word and this confuses the user. | | For a background concerning this bug report, please see: | | http://bugs.debian.org/340125 | | This bug arises only in XEmacs, not in Emacs, because key bindings are | treated differently in the two editors. The Lispref documentation of | XEmacs states explicitly this: | | For backward compatibility, a key sequence may also be represented by | a string. In this case, it represents the key sequence(s) that would | produce that sequence of ASCII characters in a purely ASCII world. | For example, a string containing the ASCII backspace character, | `"\^H"', would represent two key sequences: `(control h)' and | `backspace'. Binding a command to this will actually bind both of | those key sequences. | | According to the above, the code: | | (define-key map "\M-\C-h" 'octave-mark-defun) | | in octave-mod.el also forces the implicit binding: | | (define-key map [(meta backspace)] 'octave-mark-defun) | | in XEmacs, which is undesirable. | | | Repeat-By: | --------- | | Load a *.m file in XEmacs and type the following key strokes : "C-h" | "c" "M-backspace". It yields "octave-mark-defun". | | in Emacs, it yields "backward-kill-word", which is correct. | | Fix: | --- | | --- octave2.9-2.9.4.orig/emacs/octave-mod.el | +++ octave2.9-2.9.4/emacs/octave-mod.el | at @ -203,6 +203,9 @@ | | (defvar inferior-octave-process nil) | | +(defvar octave-xemacs-p | + (string-match "XEmacs\\|Lucid" emacs-version)) | + | (defvar octave-mode-map nil | "Keymap used in Octave mode.") | (if octave-mode-map | at @ -219,6 +222,8 @@ | (define-key map "\M-\C-a" 'octave-beginning-of-defun) | (define-key map "\M-\C-e" 'octave-end-of-defun) | (define-key map "\M-\C-h" 'octave-mark-defun) | + (if octave-xemacs-p | + (define-key map [(meta backspace)] 'backward-kill-word)) | (define-key map "\M-\C-q" 'octave-indent-defun) | (define-key map "\C-c;" 'octave-comment-region) | (define-key map "\C-c:" 'octave-uncomment-region) | at @ -638,9 +643,6 @@ | (delete-horizontal-space) | (insert (concat " " octave-continuation-string)))) | | -(defvar octave-xemacs-p | - (string-match "XEmacs\\|Lucid" emacs-version)) | - | ;;; Comments | (defun octave-comment-region (beg end &optional arg) | "Comment or uncomment each line in the region as Octave code. With this patch, is there no key binding for octave-mark-defun in XEmacs? Wouldn't it be best to come up with a key binding for octave-mark-defun that would work in both systems? I don't have a preference for a keybinding. What do other modes do for similar operations? GNU Emacs also includes a copy of octave-mod.el. I'd like to keep the two versions synchronized as much as possible, so once we agree on a change, I think it would be good if you could try to have it included in the GNU Emacs sources for octave-mod.el as well. Thanks, jwe ------------------------------------------------------------- Octave is freely available under the terms of the GNU GPL. Octave's home on the web: http://www.octave.org How to fund new projects: http://www.octave.org/funding.html Subscription information: http://www.octave.org/archive.html -------------------------------------------------------------