unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Bozhidar Batsov <bozhidar.batsov@gmail.com>
To: emacs-devel@gnu.org
Subject: Condider adding buffer-mode
Date: Thu, 24 Oct 2013 17:22:11 +0300	[thread overview]
Message-ID: <859D68184C604AE8AC385A3C5255FDAA@gmail.com> (raw)

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

I’ve seen the following code used hundreds of times:  

(buffer-local-value 'major-mode buffer)

or

(with-current-buffer buffer ‘major-mode)

Why don’t we add the following function to Emacs and simplify a bit the lives of Elisp hackers:

(defun buffer-mode (buffer) "Return the major mode associated with BUFFER." (buffer-local-value ‘major-mode buffer))  

Trivial, but useful.

--  
Cheers,
Bozhidar


[-- Attachment #2: Type: text/html, Size: 3204 bytes --]

             reply	other threads:[~2013-10-24 14:22 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-10-24 14:22 Bozhidar Batsov [this message]
2013-10-24 21:46 ` Condider adding buffer-mode Stefan Monnier
2013-10-29 15:53   ` Bozhidar Batsov
2013-10-29 16:36     ` Stefan Monnier
2013-10-29 17:28       ` Bozhidar Batsov
2013-10-29 21:56         ` Stefan Monnier
2013-10-30  9:34           ` Bozhidar Batsov
2013-10-30 12:41             ` Stefan Monnier
2013-10-31 12:57               ` Bozhidar Batsov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=859D68184C604AE8AC385A3C5255FDAA@gmail.com \
    --to=bozhidar.batsov@gmail.com \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.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).