all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* erin-mode: problem with auto-mode-alist and saving
@ 2015-10-22 14:03 Loris Bennett
  2015-10-22 14:19 ` Stefan Monnier
       [not found] ` <mailman.791.1445523623.7904.help-gnu-emacs@gnu.org>
  0 siblings, 2 replies; 8+ messages in thread
From: Loris Bennett @ 2015-10-22 14:03 UTC (permalink / raw)
  To: help-gnu-emacs

Hi,

I am using Emacs 24.4.1 on Debian Jessie and the "Edit with Emacs"
plug-in 1.14 for chromium to edit a wiki.  The buffer names created look
something like this:

  wiki.some.org/edit/Web/SomePage

I have two problems:

1. I have the following entry in my .emacs

   (setq auto-mode-alist
     (append '(("\\.C$"       . c++-mode)
               ;; ... lots of other modes, but not text-mode
               ("wiki\\..*$" . erin-mode)
               ) auto-mode-alist))

   But this doesn't work.  The buffer is opened in text-mode

2. When I turn on erin-mode by hand, this works.  However, when I save,
   the buffer reverts to text mode-mode.

Can anyone shed any light on what is going on?

Cheers,

Loris

-- 
This signature is currently under construction.


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

* Re: erin-mode: problem with auto-mode-alist and saving
  2015-10-22 14:03 erin-mode: problem with auto-mode-alist and saving Loris Bennett
@ 2015-10-22 14:19 ` Stefan Monnier
       [not found] ` <mailman.791.1445523623.7904.help-gnu-emacs@gnu.org>
  1 sibling, 0 replies; 8+ messages in thread
From: Stefan Monnier @ 2015-10-22 14:19 UTC (permalink / raw)
  To: help-gnu-emacs

> I am using Emacs 24.4.1 on Debian Jessie and the "Edit with Emacs"
> plug-in 1.14 for chromium to edit a wiki.  The buffer names created look
> something like this:
>
>   wiki.some.org/edit/Web/SomePage

auto-mode-alist is matched against the *file* name, not the *buffer* name.


        Stefan




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

* Re: erin-mode: problem with auto-mode-alist and saving
       [not found] ` <mailman.791.1445523623.7904.help-gnu-emacs@gnu.org>
@ 2015-10-22 15:05   ` Loris Bennett
  2015-10-22 22:34     ` Stefan Monnier
       [not found]     ` <mailman.839.1445553269.7904.help-gnu-emacs@gnu.org>
  0 siblings, 2 replies; 8+ messages in thread
From: Loris Bennett @ 2015-10-22 15:05 UTC (permalink / raw)
  To: help-gnu-emacs

Stefan Monnier <monnier@iro.umontreal.ca> writes:

>> I am using Emacs 24.4.1 on Debian Jessie and the "Edit with Emacs"
>> plug-in 1.14 for chromium to edit a wiki.  The buffer names created look
>> something like this:
>>
>>   wiki.some.org/edit/Web/SomePage
>
> auto-mode-alist is matched against the *file* name, not the *buffer* name.
>

OK, but the value of 'buffer-file-name' is nil.  How then can I set-up
the mode I would like?

Cheers,

Loris

-- 
Dr. Loris Bennett (Mr.)
ZEDAT, Freie Universität Berlin         Email loris.bennett@fu-berlin.de


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

* Re: erin-mode: problem with auto-mode-alist and saving
  2015-10-22 15:05   ` Loris Bennett
@ 2015-10-22 22:34     ` Stefan Monnier
       [not found]     ` <mailman.839.1445553269.7904.help-gnu-emacs@gnu.org>
  1 sibling, 0 replies; 8+ messages in thread
From: Stefan Monnier @ 2015-10-22 22:34 UTC (permalink / raw)
  To: help-gnu-emacs

>>> I am using Emacs 24.4.1 on Debian Jessie and the "Edit with Emacs"
>>> plug-in 1.14 for chromium to edit a wiki.  The buffer names created look
>>> something like this:
>>> wiki.some.org/edit/Web/SomePage
>> auto-mode-alist is matched against the *file* name, not the *buffer* name.
> OK, but the value of 'buffer-file-name' is nil.  How then can I set-up
> the mode I would like?

Depends on the actual code used to open up this "file", i.e. it depends
on how this "Edit with Emacs" plugin works internally.


        Stefan




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

* Re: erin-mode: problem with auto-mode-alist and saving
       [not found]     ` <mailman.839.1445553269.7904.help-gnu-emacs@gnu.org>
@ 2015-10-23  7:49       ` Loris Bennett
  2015-10-23  9:58         ` Joost Kremers
  0 siblings, 1 reply; 8+ messages in thread
From: Loris Bennett @ 2015-10-23  7:49 UTC (permalink / raw)
  To: help-gnu-emacs

Stefan Monnier <monnier@iro.umontreal.ca> writes:

>>>> I am using Emacs 24.4.1 on Debian Jessie and the "Edit with Emacs"
>>>> plug-in 1.14 for chromium to edit a wiki.  The buffer names created look
>>>> something like this:
>>>> wiki.some.org/edit/Web/SomePage
>>> auto-mode-alist is matched against the *file* name, not the *buffer* name.
>> OK, but the value of 'buffer-file-name' is nil.  How then can I set-up
>> the mode I would like?
>
> Depends on the actual code used to open up this "file", i.e. it depends
> on how this "Edit with Emacs" plugin works internally.
>

Thanks for the hint.

The code is on GitHub.  Here

https://github.com/stsquad/emacs_chrome/blob/master/servers/edit-server.el

it says you can do the following

(setq edit-server-url-major-mode-alist
      '(("github\\.com" . markdown-mode)))

This more or less works for me.  If I save the emacs buffer, the
contents are written back to the edit field in the browser, but the mode
switches back to 'text', and emacs hangs.  If I then do 'C-g', the mode
goes back to my chosen one.  So it's slightly broken, but functional.

Loris

-- 
This signature is currently under construction.


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

* Re: erin-mode: problem with auto-mode-alist and saving
  2015-10-23  7:49       ` Loris Bennett
@ 2015-10-23  9:58         ` Joost Kremers
  2015-10-23 10:55           ` Loris Bennett
  0 siblings, 1 reply; 8+ messages in thread
From: Joost Kremers @ 2015-10-23  9:58 UTC (permalink / raw)
  To: help-gnu-emacs

Loris Bennett wrote:
> https://github.com/stsquad/emacs_chrome/blob/master/servers/edit-server.el
>
> it says you can do the following
>
> (setq edit-server-url-major-mode-alist
>       '(("github\\.com" . markdown-mode)))
>
> This more or less works for me.  If I save the emacs buffer, the
> contents are written back to the edit field in the browser, but the mode
> switches back to 'text', and emacs hangs.  If I then do 'C-g', the mode
> goes back to my chosen one.  So it's slightly broken, but functional.

I'm pretty sure with edit-server.el you're not really supposed to save
the buffer. Just type `C-x #` when you're done editing. That'll send the
contents of the buffer to Chrome and kill the buffer.


-- 
Joost Kremers                                   joostkremers@fastmail.fm
Selbst in die Unterwelt dringt durch Spalten Licht
EN:SiS(9)


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

* Re: erin-mode: problem with auto-mode-alist and saving
  2015-10-23  9:58         ` Joost Kremers
@ 2015-10-23 10:55           ` Loris Bennett
  2015-10-23 11:26             ` Joost Kremers
  0 siblings, 1 reply; 8+ messages in thread
From: Loris Bennett @ 2015-10-23 10:55 UTC (permalink / raw)
  To: help-gnu-emacs

Joost Kremers <joost.m.kremers@gmail.com> writes:

> Loris Bennett wrote:
>> https://github.com/stsquad/emacs_chrome/blob/master/servers/edit-server.el
>>
>> it says you can do the following
>>
>> (setq edit-server-url-major-mode-alist
>>       '(("github\\.com" . markdown-mode)))
>>
>> This more or less works for me.  If I save the emacs buffer, the
>> contents are written back to the edit field in the browser, but the mode
>> switches back to 'text', and emacs hangs.  If I then do 'C-g', the mode
>> goes back to my chosen one.  So it's slightly broken, but functional.
>
> I'm pretty sure with edit-server.el you're not really supposed to save
> the buffer. Just type `C-x #` when you're done editing. That'll send the
> contents of the buffer to Chrome and kill the buffer.

Yes, it really doesn't look as if you are supposed to save the buffer.
However, if I'm taking the minutes of an hour-and-a-half-long meeting in
a corner of the building where the wifi is a bit flakey, my 'C-x C-s'
reflex kicks in.  However, as the text is only written to the text box,
it won't help me if the connection goes down just as I try to save
within the browser.

It would be nice if there were some way to attach a file to a file-less
buffer, just in case.

Loris

-- 
This signature is currently under construction.


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

* Re: erin-mode: problem with auto-mode-alist and saving
  2015-10-23 10:55           ` Loris Bennett
@ 2015-10-23 11:26             ` Joost Kremers
  0 siblings, 0 replies; 8+ messages in thread
From: Joost Kremers @ 2015-10-23 11:26 UTC (permalink / raw)
  To: help-gnu-emacs

Loris Bennett wrote:
> Joost Kremers <joost.m.kremers@gmail.com> writes:
>> I'm pretty sure with edit-server.el you're not really supposed to save
>> the buffer. Just type `C-x #` when you're done editing. That'll send the
>> contents of the buffer to Chrome and kill the buffer.
>
> Yes, it really doesn't look as if you are supposed to save the buffer.
> However, if I'm taking the minutes of an hour-and-a-half-long meeting in
> a corner of the building where the wifi is a bit flakey, my 'C-x C-s'
> reflex kicks in.  However, as the text is only written to the text box,
> it won't help me if the connection goes down just as I try to save
> within the browser.

Perhaps you should just keep the minutes in a separate temp file and
only copy&paste it to the browser when the meeting's done?

> It would be nice if there were some way to attach a file to a file-less
> buffer, just in case.

Found this on Stack Overflow:

http://stackoverflow.com/questions/8849661/is-it-possible-to-autosave-temporary-buffers-that-are-not-visiting-a-file

Apparently, `auto-save-mode` will work with buffers that are not
visiting a file. 

Also:

http://stackoverflow.com/questions/18770669/how-can-i-save-as-in-emacs-without-visiting-the-new-file

For ways to manually write a buffer to a file without visiting it.

HTH



-- 
Joost Kremers                                   joostkremers@fastmail.fm
Selbst in die Unterwelt dringt durch Spalten Licht
EN:SiS(9)


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

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

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-10-22 14:03 erin-mode: problem with auto-mode-alist and saving Loris Bennett
2015-10-22 14:19 ` Stefan Monnier
     [not found] ` <mailman.791.1445523623.7904.help-gnu-emacs@gnu.org>
2015-10-22 15:05   ` Loris Bennett
2015-10-22 22:34     ` Stefan Monnier
     [not found]     ` <mailman.839.1445553269.7904.help-gnu-emacs@gnu.org>
2015-10-23  7:49       ` Loris Bennett
2015-10-23  9:58         ` Joost Kremers
2015-10-23 10:55           ` Loris Bennett
2015-10-23 11:26             ` Joost Kremers

Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.