emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* TAB key isn't bound to org-cycle with emacs on console
@ 2007-02-08 14:52 Tassilo Horn
  2007-02-09  8:17 ` Carsten Dominik
  0 siblings, 1 reply; 3+ messages in thread
From: Tassilo Horn @ 2007-02-08 14:52 UTC (permalink / raw)
  To: emacs-orgmode

Hello,

I use Org since about 2 month and I really enjoy it. Normally I use
GNU/Emacs with its X11 interface, but today I noticed that TAB is not
bound to `org-cycle' when I use emacs -nw or emacs in a login
shell. Then it's bound to the function I local-set-key it in
fundamental-mode-hook.

,----[ grep -A2 fundamental-mode-hook ~/.emacs ]
| (add-hook 'fundamental-mode-hook
|           (lambda ()
|             (local-set-key "\C-i" 'th-complete-or-indent)))
`----

When I do M-x org-cycle emacs echoes that I can run this function with
<tab>, too.

Does anyone suspect what could be the culprit?

BTW: I use Org-mode-4.64.

Bye,
Tassilo
-- 
[Emacs] is written in Lisp, which is the only computer language that is
beautiful.  -- Neal Stephenson, _In the Beginning was the Command Line_

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

* Re: TAB key isn't bound to org-cycle with emacs on console
  2007-02-08 14:52 TAB key isn't bound to org-cycle with emacs on console Tassilo Horn
@ 2007-02-09  8:17 ` Carsten Dominik
  2007-02-09 10:24   ` Tassilo Horn
  0 siblings, 1 reply; 3+ messages in thread
From: Carsten Dominik @ 2007-02-09  8:17 UTC (permalink / raw)
  To: Tassilo Horn; +Cc: emacs-orgmode


On Feb 8, 2007, at 15:52, Tassilo Horn wrote:

> Hello,
>
> I use Org since about 2 month and I really enjoy it. Normally I use
> GNU/Emacs with its X11 interface, but today I noticed that TAB is not
> bound to `org-cycle' when I use emacs -nw or emacs in a login
> shell. Then it's bound to the function I local-set-key it in
> fundamental-mode-hook.
>
> ,----[ grep -A2 fundamental-mode-hook ~/.emacs ]
> | (add-hook 'fundamental-mode-hook
> |           (lambda ()
> |             (local-set-key "\C-i" 'th-complete-or-indent)))
> `----
>
> When I do M-x org-cycle emacs echoes that I can run this function with
> <tab>, too.


First of all, not all terminal programs can distinguish between the TAB 
key and C-i - obviously yours cannot.  I am not sure if this can be 
fixed with som setup - you need to look into documentation on terminal 
windows for this.

If you cannot fix this,  you need to have org-cycle bound to C-i in 
order to get it executed by TAB.

The problem is that you do the above binding in a hook, and that you 
use local-set-key to do it.  Local-set-key defines the key in the 
current local map, which in org-mode is org-mode-map.  
Fundamental-mode-hook seems to be run (I did not know this!) when 
org-mode is started, because org-mode is derived from outline-mode, 
which is derived from text-mode which is derived from fundamental-mode, 
so all these hooks are run!

Here is what you can do:

1. Did you really intend to have this key binding in all modes, or did 
you only want it in fundamental mode?

If you only need it in, say, fundamental-mode and in text-mode, you 
could do

(define-key fundamental-mode-map "\C-i" th-......)
(define-key text-mode-map "\C-i" th-......)

2. If you really meant to have this in all modes except org-mode, you 
can make org-mode-hook (which runs after fundamental-mode-hook) to 
overrule this binding again.

(add-hook 'org-mode-hook
           (lambda ()
              (local-set-key "\C-i" 'th-complete-or-indent)))

3. You could make th-complete-or-indent smarter so that it calls 
org-cycle when you are in org-mode.


Hope this helps

- Carsten


>
> Does anyone suspect what could be the culprit?
>
> BTW: I use Org-mode-4.64.
>
> Bye,
> Tassilo
> -- 
> [Emacs] is written in Lisp, which is the only computer language that is
> beautiful.  -- Neal Stephenson, _In the Beginning was the Command Line_
>
>
>
> _______________________________________________
> Emacs-orgmode mailing list
> Emacs-orgmode@gnu.org
> http://lists.gnu.org/mailman/listinfo/emacs-orgmode
>
>

--
Carsten Dominik
Sterrenkundig Instituut "Anton Pannekoek"
Universiteit van Amsterdam
Kruislaan 403
NL-1098SJ Amsterdam
phone: +31 20 525 7477

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

* Re: TAB key isn't bound to org-cycle with emacs on console
  2007-02-09  8:17 ` Carsten Dominik
@ 2007-02-09 10:24   ` Tassilo Horn
  0 siblings, 0 replies; 3+ messages in thread
From: Tassilo Horn @ 2007-02-09 10:24 UTC (permalink / raw)
  To: emacs-orgmode

Carsten Dominik <dominik@science.uva.nl> writes:

Hi Carsten,

> First of all, not all terminal programs can distinguish between the
> TAB key and C-i - obviously yours cannot.  I am not sure if this can
> be fixed with som setup - you need to look into documentation on
> terminal windows for this.

Hm, I've tried the usual linux login shell, urxvt, xterm and
konsole. None of them seem to be capable of it, at least not with their
default settings.

> If you cannot fix this, you need to have org-cycle bound to C-i in
> order to get it executed by TAB.

Ok, no problem.

> The problem is that you do the above binding in a hook, and that you
> use local-set-key to do it.  Local-set-key defines the key in the
> current local map, which in org-mode is org-mode-map.
> Fundamental-mode-hook seems to be run (I did not know this!)

It was introduced yesterday and removed on RMS demand some hours
later. ;-)

Nevertheless, I've bound th-complete-or-indent in text-mode, too.

> when org-mode is started, because org-mode is derived from
> outline-mode, which is derived from text-mode which is derived from
> fundamental-mode, so all these hooks are run!
>
> Here is what you can do:
>
> 1. Did you really intend to have this key binding in all modes, or did
> you only want it in fundamental mode?

Well, I want to have them in all modes that don't use TAB for a
different purpose than indenting.

> 2. If you really meant to have this in all modes except org-mode, you
> can make org-mode-hook (which runs after fundamental-mode-hook) to
> overrule this binding again.
>
> (add-hook 'org-mode-hook
>           (lambda ()
>              (local-set-key "\C-i" 'th-complete-or-indent)))
>                                     ^^^^^^^^^^^^^^^^^^^^^

I guess you've meant org-cycle there, right?

> 3. You could make th-complete-or-indent smarter so that it calls
> org-cycle when you are in org-mode.

Well, yes. But if I think about the whole function: I've written it,
because typing `dabbrev-expand' (M-/) is a pain on German keyboards and
I didn't want to lose indenting functionality with tab. But a while ago
I switched to a German Dvorak Typ II layout, where M-/ is easily
accessible. So I'll bint th-complete-or-indent to M-/ globally.

Bye,
Tassilo

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

end of thread, other threads:[~2007-02-09 10:24 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-02-08 14:52 TAB key isn't bound to org-cycle with emacs on console Tassilo Horn
2007-02-09  8:17 ` Carsten Dominik
2007-02-09 10:24   ` Tassilo Horn

Code repositories for project(s) associated with this public inbox

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

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).