unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* Why different behaviour of concat on OSX and on Lubuntu
@ 2013-05-28 18:27 Guido Van Hoecke
  2013-05-28 20:34 ` Michael Heerdegen
  0 siblings, 1 reply; 3+ messages in thread
From: Guido Van Hoecke @ 2013-05-28 18:27 UTC (permalink / raw)
  To: help-gnu-emacs@gnu.org

Hi,

My main machine is an iMAC (querty keyboard) running GNU Emacs 24.3.1
(x86_64-apple-darwin, NS apple-appkit-1187.37)

I have to use temporarily an old notbook (belgian azerty keyboard)
running Lubuntu GNU Emacs 24.2.1 (i686-pc-linux-gnu, GTK+ Version
3.6.4) of 2013-04-09 on komainu, modified by Debian.

I use a seldom used key to create some mappings.

Part of the code looks like this:
;; check whether running on OSX
(setq isOSX (equal (expand-file-name "~/") "/Users/guivho/"))

(if isOSX
    (setq leader "§")
  (setq leader "²"))

(global-set-key (kbd (concat "M-" leader)) 'overwrite-mode)

The last statement maps overwrite-mode to the M-§ sequence on my iMac.

On the Lubuntu machine, it does not map M-² to overwrite-mode, It barks:

(wrong-type-argument integer-or-marker-p (concat "M-" leader))
  read-kbd-macro((concat "M-" leader)

On the other hand, the following commands do work on both machines:

(define-prefix-command 'guivho-map nil "guivho-")

(define-key guivho-map    leader 'guivho-save-and-kill-buffer)
(define-key guivho-map    "-" 'hl-line-mode)
(define-key guivho-map    "=" 'vc-diff)
(define-key guivho-map    "0" 'delete-window)
...
(define-key guivho-map "z" (lambda() (interactive)
(switch-to-buffer-other-window "*scratch*" t)))
(global-set-key leader guivho-map)

I am puzzled why the concat does not work on lubuntu, and would like
to know how to code it to achieve the desired effect.

Thanks in advance,

Guivho.



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Why different behaviour of concat on OSX and on Lubuntu
  2013-05-28 18:27 Why different behaviour of concat on OSX and on Lubuntu Guido Van Hoecke
@ 2013-05-28 20:34 ` Michael Heerdegen
  2013-05-29 20:42   ` Guido Van Hoecke
  0 siblings, 1 reply; 3+ messages in thread
From: Michael Heerdegen @ 2013-05-28 20:34 UTC (permalink / raw)
  To: Guido Van Hoecke; +Cc: help-gnu-emacs@gnu.org

Guido Van Hoecke <guivho@gmail.com> writes:

> Part of the code looks like this:
> ;; check whether running on OSX
> (setq isOSX (equal (expand-file-name "~/") "/Users/guivho/"))
>
> (if isOSX
>     (setq leader "§")
>   (setq leader "²"))
>
> (global-set-key (kbd (concat "M-" leader)) 'overwrite-mode)
>
> The last statement maps overwrite-mode to the M-§ sequence on my iMac.
>
> On the Lubuntu machine, it does not map M-² to overwrite-mode, It barks:
>
> (wrong-type-argument integer-or-marker-p (concat "M-" leader))
>   read-kbd-macro((concat "M-" leader)
> [...]
> I am puzzled why the concat does not work on lubuntu, and would like
> to know how to code it to achieve the desired effect.

`kbd' was a (quite strange) macro in Emacs 23.  It changed to a function
in Emacs 24.  Your code works only in the last case.  Call it a bug in
Emacs 23.

As long as you need to use both Emacs versions in parallel, you should
be safe when you use `read-kbd-macro' instead of `kbd'.  It does the
same, but should work in both versions.


Regards,

Michael.



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Why different behaviour of concat on OSX and on Lubuntu
  2013-05-28 20:34 ` Michael Heerdegen
@ 2013-05-29 20:42   ` Guido Van Hoecke
  0 siblings, 0 replies; 3+ messages in thread
From: Guido Van Hoecke @ 2013-05-29 20:42 UTC (permalink / raw)
  To: help-gnu-emacs@gnu.org

Hi Michael,

Thanks for your reply.

I couldn't get this to work. Being pressed for time I just changed to
(if isOSX
    (global-set-key (kbd "M-§") 'overwrite-mode)
  (global-set-key (kbd "M-²") 'overwrite-mode))

With kind regards,

Guido.

On 28 May 2013 22:34, Michael Heerdegen <michael_heerdegen@web.de> wrote:
> Guido Van Hoecke <guivho@gmail.com> writes:
>
>> Part of the code looks like this:
>> ;; check whether running on OSX
>> (setq isOSX (equal (expand-file-name "~/") "/Users/guivho/"))
>>
>> (if isOSX
>>     (setq leader "§")
>>   (setq leader "²"))
>>
>> (global-set-key (kbd (concat "M-" leader)) 'overwrite-mode)
>>
>> The last statement maps overwrite-mode to the M-§ sequence on my iMac.
>>
>> On the Lubuntu machine, it does not map M-² to overwrite-mode, It barks:
>>
>> (wrong-type-argument integer-or-marker-p (concat "M-" leader))
>>   read-kbd-macro((concat "M-" leader)
>> [...]
>> I am puzzled why the concat does not work on lubuntu, and would like
>> to know how to code it to achieve the desired effect.
>
> `kbd' was a (quite strange) macro in Emacs 23.  It changed to a function
> in Emacs 24.  Your code works only in the last case.  Call it a bug in
> Emacs 23.
>
> As long as you need to use both Emacs versions in parallel, you should
> be safe when you use `read-kbd-macro' instead of `kbd'.  It does the
> same, but should work in both versions.
>
>
> Regards,
>
> Michael.



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2013-05-29 20:42 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-05-28 18:27 Why different behaviour of concat on OSX and on Lubuntu Guido Van Hoecke
2013-05-28 20:34 ` Michael Heerdegen
2013-05-29 20:42   ` Guido Van Hoecke

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).