emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* set modes for org-edit-special (elisp block)
@ 2016-01-24  5:26 Stefan Huchler
  2016-01-24  5:33 ` Kyle Meyer
  0 siblings, 1 reply; 10+ messages in thread
From: Stefan Huchler @ 2016-01-24  5:26 UTC (permalink / raw)
  To: emacs-orgmode

Hi,

org-edit-special opens elisp code with emacs-lisp mode, which is not
bad, but I wanted to try out xah-elisp-mode for am while.

tried to overwrite or shadow the settings with something like

(add-to-list 'org-src-lang-modes '("xah-elisp" . emacs-lisp))

am I here at the right place to change that behaviour?

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

* Re: set modes for org-edit-special (elisp block)
  2016-01-24  5:26 set modes for org-edit-special (elisp block) Stefan Huchler
@ 2016-01-24  5:33 ` Kyle Meyer
  2016-01-24 17:35   ` Stefan Huchler
  0 siblings, 1 reply; 10+ messages in thread
From: Kyle Meyer @ 2016-01-24  5:33 UTC (permalink / raw)
  To: Stefan Huchler; +Cc: emacs-orgmode

Hello,

Stefan Huchler <stefan.huchler@mail.de> writes:

> Hi,
>
> org-edit-special opens elisp code with emacs-lisp mode, which is not
> bad, but I wanted to try out xah-elisp-mode for am while.
>
> tried to overwrite or shadow the settings with something like
>
> (add-to-list 'org-src-lang-modes '("xah-elisp" . emacs-lisp))
>
> am I here at the right place to change that behaviour?

Looks like you've got the right variable, but the key should be the
language name and the value should be major mode you want.

    ("elisp" . xah-emacs-lisp)

-- 
Kyle

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

* Re: set modes for org-edit-special (elisp block)
  2016-01-24  5:33 ` Kyle Meyer
@ 2016-01-24 17:35   ` Stefan Huchler
  2016-01-24 17:50     ` Kyle Meyer
  2016-01-25 13:05     ` Alan Schmitt
  0 siblings, 2 replies; 10+ messages in thread
From: Stefan Huchler @ 2016-01-24 17:35 UTC (permalink / raw)
  To: emacs-orgmode

Kyle Meyer <kyle@kyleam.com> writes:

>
> Looks like you've got the right variable, but the key should be the
> language name and the value should be major mode you want.
>
>     ("elisp" . xah-emacs-lisp)

I changed it a few times and I think I had it this way first, do I have
to reload org after it? I closed the file and reopened it did not help.

But I can try it again with that, maybe I really did not have it that
way.

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

* Re: set modes for org-edit-special (elisp block)
  2016-01-24 17:35   ` Stefan Huchler
@ 2016-01-24 17:50     ` Kyle Meyer
  2016-01-25 13:05     ` Alan Schmitt
  1 sibling, 0 replies; 10+ messages in thread
From: Kyle Meyer @ 2016-01-24 17:50 UTC (permalink / raw)
  To: Stefan Huchler; +Cc: emacs-orgmode

Stefan Huchler <stefan.huchler@mail.de> writes:

> Kyle Meyer <kyle@kyleam.com> writes:
>
>>
>> Looks like you've got the right variable, but the key should be the
>> language name and the value should be major mode you want.
>>
>>     ("elisp" . xah-emacs-lisp)
>
> I changed it a few times and I think I had it this way first, do I have
> to reload org after it? I closed the file and reopened it did not help.

Once you've modify org-src-lang-modes, it should work.  Since I don't
have xah-emacs-lisp-mode installed, I've just tested it with
python-mode.

  (add-to-list 'org-src-lang-modes '("elisp" . python))

After evaluating above, org-edit-special opens up

  #+begin_src elisp
    import sys
  #+end_src

in python-mode.

-- 
Kyle

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

* Re: set modes for org-edit-special (elisp block)
  2016-01-24 17:35   ` Stefan Huchler
  2016-01-24 17:50     ` Kyle Meyer
@ 2016-01-25 13:05     ` Alan Schmitt
  2016-01-25 15:11       ` Kyle Meyer
  1 sibling, 1 reply; 10+ messages in thread
From: Alan Schmitt @ 2016-01-25 13:05 UTC (permalink / raw)
  To: Stefan Huchler; +Cc: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 742 bytes --]

On 2016-01-24 18:35, Stefan Huchler <stefan.huchler@mail.de> writes:

> Kyle Meyer <kyle@kyleam.com> writes:
>
>>
>> Looks like you've got the right variable, but the key should be the
>> language name and the value should be major mode you want.
>>
>>     ("elisp" . xah-emacs-lisp)
>
> I changed it a few times and I think I had it this way first, do I have
> to reload org after it? I closed the file and reopened it did not help.

Shouldn’t it be "xah-elisp" (the mode is "xah-elisp-mode"). I gave it
a try and it’s also not working out of the box for me. I also restarted
emacs, to no avail.

Alan

-- 
OpenPGP Key ID : 040D0A3B4ED2E5C7
Athmospheric CO₂ (Updated January 24, 2016, Mauna Loa Obs.): 402.49 ppm

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 472 bytes --]

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

* Re: set modes for org-edit-special (elisp block)
  2016-01-25 13:05     ` Alan Schmitt
@ 2016-01-25 15:11       ` Kyle Meyer
  2016-01-25 15:45         ` Alan Schmitt
  0 siblings, 1 reply; 10+ messages in thread
From: Kyle Meyer @ 2016-01-25 15:11 UTC (permalink / raw)
  To: Alan Schmitt; +Cc: emacs-orgmode, Stefan Huchler

Alan Schmitt <alan.schmitt@polytechnique.org> writes:

> On 2016-01-24 18:35, Stefan Huchler <stefan.huchler@mail.de> writes:
>
>> Kyle Meyer <kyle@kyleam.com> writes:
>>
>>>
>>> Looks like you've got the right variable, but the key should be the
>>> language name and the value should be major mode you want.
>>>
>>>     ("elisp" . xah-emacs-lisp)
>>
>> I changed it a few times and I think I had it this way first, do I have
>> to reload org after it? I closed the file and reopened it did not help.
>
> Shouldn’t it be "xah-elisp" (the mode is "xah-elisp-mode"). I gave it
> a try and it’s also not working out of the box for me. I also restarted
> emacs, to no avail.

Right, sorry.  It should be whatever the mode name is, minus "-mode".
Is it just xah-elisp-mode that is giving you a problem?  Did you try
with the example I gave in my previous message ($gmane/104430)?

-- 
Kyle

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

* Re: set modes for org-edit-special (elisp block)
  2016-01-25 15:11       ` Kyle Meyer
@ 2016-01-25 15:45         ` Alan Schmitt
  2016-01-25 17:32           ` Kyle Meyer
  2016-01-25 17:37           ` Nick Dokos
  0 siblings, 2 replies; 10+ messages in thread
From: Alan Schmitt @ 2016-01-25 15:45 UTC (permalink / raw)
  To: Kyle Meyer; +Cc: emacs-orgmode, Stefan Huchler

[-- Attachment #1: Type: text/plain, Size: 1485 bytes --]

On 2016-01-25 10:11, Kyle Meyer <kyle@kyleam.com> writes:

> Alan Schmitt <alan.schmitt@polytechnique.org> writes:
>
>> On 2016-01-24 18:35, Stefan Huchler <stefan.huchler@mail.de> writes:
>>
>>> Kyle Meyer <kyle@kyleam.com> writes:
>>>
>>>>
>>>> Looks like you've got the right variable, but the key should be the
>>>> language name and the value should be major mode you want.
>>>>
>>>>     ("elisp" . xah-emacs-lisp)
>>>
>>> I changed it a few times and I think I had it this way first, do I have
>>> to reload org after it? I closed the file and reopened it did not help.
>>
>> Shouldn’t it be "xah-elisp" (the mode is "xah-elisp-mode"). I gave it
>> a try and it’s also not working out of the box for me. I also restarted
>> emacs, to no avail.
>
> Right, sorry.  It should be whatever the mode name is, minus "-mode".
> Is it just xah-elisp-mode that is giving you a problem?  Did you try
> with the example I gave in my previous message ($gmane/104430)?

I’m having the same problem with python: I’m still in emacs-lisp mode.
I checked the value of the variable and it is as expected. For some
reason the change is not picked up. Is it because there are several
occurrences of "elisp" in the list and it’s not the first one that is
picked up?

I’m using a fairly current org (compiled last week from master).

Alan

-- 
OpenPGP Key ID : 040D0A3B4ED2E5C7
Athmospheric CO₂ (Updated January 24, 2016, Mauna Loa Obs.): 402.49 ppm

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 472 bytes --]

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

* Re: set modes for org-edit-special (elisp block)
  2016-01-25 15:45         ` Alan Schmitt
@ 2016-01-25 17:32           ` Kyle Meyer
  2016-01-25 17:37           ` Nick Dokos
  1 sibling, 0 replies; 10+ messages in thread
From: Kyle Meyer @ 2016-01-25 17:32 UTC (permalink / raw)
  To: Alan Schmitt; +Cc: emacs-orgmode, Stefan Huchler

Alan Schmitt <alan.schmitt@polytechnique.org> writes:

[...]

> I’m having the same problem with python: I’m still in emacs-lisp mode.
> I checked the value of the variable and it is as expected. For some
> reason the change is not picked up. Is it because there are several
> occurrences of "elisp" in the list and it’s not the first one that is
> picked up?

No, I don't think repeated keys are an issue as long as the one you want
occurs first.  (org-src--get-lang-mode uses assoc.)  It really should
just boil down to

   (cdr (assoc "elisp" org-src-lang-modes))

Perhaps you step through org-src--get-lang-mode (which is called by
org-edit-src-code) to see what's going on.

-- 
Kyle

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

* Re: set modes for org-edit-special (elisp block)
  2016-01-25 15:45         ` Alan Schmitt
  2016-01-25 17:32           ` Kyle Meyer
@ 2016-01-25 17:37           ` Nick Dokos
  2016-01-26 10:23             ` Alan Schmitt
  1 sibling, 1 reply; 10+ messages in thread
From: Nick Dokos @ 2016-01-25 17:37 UTC (permalink / raw)
  To: emacs-orgmode

Alan Schmitt <alan.schmitt@polytechnique.org> writes:

> I’m having the same problem with python: I’m still in emacs-lisp mode.
> I checked the value of the variable and it is as expected. For some
> reason the change is not picked up. Is it because there are several
> occurrences of "elisp" in the list and it’s not the first one that is
> picked up?
>

org-src--get-lang-mode uses assoc, so it should pick up the first pair
whose car matches. You can try it by hand:

(org-src--get-lang-mode "elisp")

Of course, it's possible (but unlikely) that somebody is using some
other way to get at the mode.

--
Nick

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

* Re: set modes for org-edit-special (elisp block)
  2016-01-25 17:37           ` Nick Dokos
@ 2016-01-26 10:23             ` Alan Schmitt
  0 siblings, 0 replies; 10+ messages in thread
From: Alan Schmitt @ 2016-01-26 10:23 UTC (permalink / raw)
  To: Nick Dokos; +Cc: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 1086 bytes --]

Hello,

On 2016-01-25 12:37, Nick Dokos <ndokos@gmail.com> writes:

> Alan Schmitt <alan.schmitt@polytechnique.org> writes:
>
>> I’m having the same problem with python: I’m still in emacs-lisp mode.
>> I checked the value of the variable and it is as expected. For some
>> reason the change is not picked up. Is it because there are several
>> occurrences of "elisp" in the list and it’s not the first one that is
>> picked up?
>>
>
> org-src--get-lang-mode uses assoc, so it should pick up the first pair
> whose car matches. You can try it by hand:
>
> (org-src--get-lang-mode "elisp")
>
> Of course, it's possible (but unlikely) that somebody is using some
> other way to get at the mode.

I finally found the source of my problem, and I feel very stupid: my
elisp blocks use the name "emacs-lisp" as language, so this
customization was not picked up, since "elisp" and "emacs-lisp" are
different.

Sorry for the confusion,

Alan

-- 
OpenPGP Key ID : 040D0A3B4ED2E5C7
Athmospheric CO₂ (Updated January 25, 2016, Mauna Loa Obs.): 404.15 ppm

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 472 bytes --]

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

end of thread, other threads:[~2016-01-26 10:23 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-01-24  5:26 set modes for org-edit-special (elisp block) Stefan Huchler
2016-01-24  5:33 ` Kyle Meyer
2016-01-24 17:35   ` Stefan Huchler
2016-01-24 17:50     ` Kyle Meyer
2016-01-25 13:05     ` Alan Schmitt
2016-01-25 15:11       ` Kyle Meyer
2016-01-25 15:45         ` Alan Schmitt
2016-01-25 17:32           ` Kyle Meyer
2016-01-25 17:37           ` Nick Dokos
2016-01-26 10:23             ` Alan Schmitt

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