unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* Getting and Setting major-modes of buffers
@ 2008-01-17 11:45 Nordlöw
  2008-01-17 12:39 ` Xah Lee
  2008-01-17 16:19 ` Lennart Borgman (gmail)
  0 siblings, 2 replies; 3+ messages in thread
From: Nordlöw @ 2008-01-17 11:45 UTC (permalink / raw)
  To: help-gnu-emacs

Hi!

How do I determine the major-mode of a buffer (not necessarily the
current) and make another buffer enter that same mode?

Thanks in advance,
Nordlöw

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

* Re: Getting and Setting major-modes of buffers
  2008-01-17 11:45 Getting and Setting major-modes of buffers Nordlöw
@ 2008-01-17 12:39 ` Xah Lee
  2008-01-17 16:19 ` Lennart Borgman (gmail)
  1 sibling, 0 replies; 3+ messages in thread
From: Xah Lee @ 2008-01-17 12:39 UTC (permalink / raw)
  To: help-gnu-emacs

On Jan 17, 3:45 am, "Nordlöw" <per.nord...@gmail.com> wrote:
> How do I determine the major-mode of a buffer (not necessarily the
> current) and make another buffer enter that same mode?

switch to that buffer, then
(symbol-value 'major-mode)

  Xah
  xah@xahlee.org
∑ http://xahlee.org/

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

* Re: Getting and Setting major-modes of buffers
  2008-01-17 11:45 Getting and Setting major-modes of buffers Nordlöw
  2008-01-17 12:39 ` Xah Lee
@ 2008-01-17 16:19 ` Lennart Borgman (gmail)
  1 sibling, 0 replies; 3+ messages in thread
From: Lennart Borgman (gmail) @ 2008-01-17 16:19 UTC (permalink / raw)
  To: Nordlöw; +Cc: help-gnu-emacs

Nordlöw wrote:
> Hi!
> 
> How do I determine the major-mode of a buffer (not necessarily the
> current) and make another buffer enter that same mode?
> 
> Thanks in advance,
> Nordlöw


(defun set-same-major-mode-as (buffer)
   (interactive "bSet same major mode as buffer: ")
   (let ((major (with-current-buffer buffer major-mode)))
     (funcall major)))

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

end of thread, other threads:[~2008-01-17 16:19 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-01-17 11:45 Getting and Setting major-modes of buffers Nordlöw
2008-01-17 12:39 ` Xah Lee
2008-01-17 16:19 ` Lennart Borgman (gmail)

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