all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* set-buffer-major-mode: how to use on buffer without file?
@ 2021-03-25  7:53 Jean Louis
  2021-03-25 14:26 ` Stefan Monnier
  0 siblings, 1 reply; 3+ messages in thread
From: Jean Louis @ 2021-03-25  7:53 UTC (permalink / raw)
  To: Help GNU Emacs

I would like to set major mode for the buffer which only displays a
revision in a buffer without associated file. The buffer name may end
with let us say .scm for scheme or .org for Org mode, I would like to
invoke the major mode based on the file extension.

Maybe `set-buffer-major-mode' is right function?

Or maybe some other?

Jean




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

* Re: set-buffer-major-mode: how to use on buffer without file?
  2021-03-25  7:53 set-buffer-major-mode: how to use on buffer without file? Jean Louis
@ 2021-03-25 14:26 ` Stefan Monnier
  2021-03-25 15:07   ` Jean Louis
  0 siblings, 1 reply; 3+ messages in thread
From: Stefan Monnier @ 2021-03-25 14:26 UTC (permalink / raw)
  To: help-gnu-emacs

> I would like to set major mode for the buffer which only displays a
> revision in a buffer without associated file.

Your use of "the buffer" above is hilarious: it makes it sound like we
all should know, as a matter of course, which buffer it is you're
talking about, like if it had been on the front page of the newspaper
or something.

> The buffer name may end with let us say .scm for scheme or .org for
> Org mode, I would like to invoke the major mode based on the
> file extension.

You may want to do: `C-h o C-x v ~` and then look at the implementation
of that command (since that command does something closely related to
what you describe).


        Stefan




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

* Re: set-buffer-major-mode: how to use on buffer without file?
  2021-03-25 14:26 ` Stefan Monnier
@ 2021-03-25 15:07   ` Jean Louis
  0 siblings, 0 replies; 3+ messages in thread
From: Jean Louis @ 2021-03-25 15:07 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: help-gnu-emacs

* Stefan Monnier <monnier@iro.umontreal.ca> [2021-03-25 17:31]:
> > I would like to set major mode for the buffer which only displays a
> > revision in a buffer without associated file.
> 
> Your use of "the buffer" above is hilarious: it makes it sound like we
> all should know, as a matter of course, which buffer it is you're
> talking about, like if it had been on the front page of the newspaper
> or something.

I have not expressed myself clearly, I have buffers that come from
database, and are not associated to the file within Emacs
context. Within program they are associated with the file with
specific extension.

vcfiles_filename entry may be "/home/admin/new.scm"

and buffer name becomes something like:

RCD VC Revision ID: 12, /home/admin/new.scm

so buffer is not really associated within Emacs context to file name,
within program's context it is directly associated. Now when I entered
the sphere of auto mode settings I can see that for buffers that
function is missing, or is not there. Am I right?

set-auto-mode function does not verify anything for buffers how I see
it. Maybe it would be better to have something for buffers not
associated to files.

Right now I am doing that trick to associate the file to buffer and
then set auto mode, and then I can disassociate file from buffer. I am
then associating the above example with
/home/admin/RCD-VC-Revision-ID-12-new.scm as that way it becomes
unique file.

So it is solved on my side.

But I still think that auto mode should also work in buffers without
file, at least when user enables it.

Jean



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

end of thread, other threads:[~2021-03-25 15:07 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-03-25  7:53 set-buffer-major-mode: how to use on buffer without file? Jean Louis
2021-03-25 14:26 ` Stefan Monnier
2021-03-25 15:07   ` Jean Louis

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.