all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / 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)

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.