From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Bozhidar Batsov Newsgroups: gmane.emacs.devel Subject: Condider adding buffer-mode Date: Thu, 24 Oct 2013 17:22:11 +0300 Message-ID: <859D68184C604AE8AC385A3C5255FDAA@gmail.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="52692d13_4b588f54_41c" X-Trace: ger.gmane.org 1382627588 3976 80.91.229.3 (24 Oct 2013 15:13:08 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 24 Oct 2013 15:13:08 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Oct 24 17:13:12 2013 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1VZMb1-0003RN-8N for ged-emacs-devel@m.gmane.org; Thu, 24 Oct 2013 17:13:11 +0200 Original-Received: from localhost ([::1]:54798 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VZMb0-0003zl-QE for ged-emacs-devel@m.gmane.org; Thu, 24 Oct 2013 11:13:10 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:59022) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VZLo2-0003iU-Qj for emacs-devel@gnu.org; Thu, 24 Oct 2013 10:22:43 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VZLnu-0000G5-Ay for emacs-devel@gnu.org; Thu, 24 Oct 2013 10:22:34 -0400 Original-Received: from mail-bk0-x233.google.com ([2a00:1450:4008:c01::233]:50989) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VZLnu-0000Fh-0x for emacs-devel@gnu.org; Thu, 24 Oct 2013 10:22:26 -0400 Original-Received: by mail-bk0-f51.google.com with SMTP id mx10so892268bkb.10 for ; Thu, 24 Oct 2013 07:22:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:message-id:subject:mime-version:content-type; bh=n3WYbrxCxE85qvYtK64vH7NjhrcVw1XWqSVyRdA6+w0=; b=oeexrYBAdeKRv2kcmCHXjy8MUl+o2MGXVjyexTyVwLOPeOD3RwZ29rO0mmU+hZI10q y7yDuEGkhMGGk9XFdFNbzR9YD6i/xbnrfkN27muiYDCO9Nn0KsZHg/3VAcCk+r2vJki6 1WING0DrX8P2kpkCJr4AWLa9ZOVREI0g2yvKBCW1xZUpTxYp2AkzPp6rj2kd1Jco8VsU a45cqDhW4KXjKzD4EPlcExvAVSb553mv0jUs7zHIlQJEnl2PdUh8UUmoL3luHEflkiik tlwSmBjzRJw0hbx/LhwwZGnvIp1XlSBJ/oAQ5edBzFMbbQoAJez5IN6ZkmJjPtf1bC4H 1z1Q== X-Received: by 10.204.173.77 with SMTP id o13mr402189bkz.60.1382624545012; Thu, 24 Oct 2013 07:22:25 -0700 (PDT) Original-Received: from [192.168.1.28] ([95.87.231.111]) by mx.google.com with ESMTPSA id pk7sm1491731bkb.2.2013.10.24.07.22.23 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Thu, 24 Oct 2013 07:22:24 -0700 (PDT) X-Mailer: sparrow 1.6.4 (build 1178) X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2a00:1450:4008:c01::233 X-Mailman-Approved-At: Thu, 24 Oct 2013 11:13:07 -0400 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:164514 Archived-At: --52692d13_4b588f54_41c Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline I=E2=80=99ve seen the following code used hundreds of times: =20 (buffer-local-value 'major-mode buffer) or (with-current-buffer buffer =E2=80=98major-mode) Why don=E2=80=99t we add the following function to Emacs and simplify a b= it the lives of Elisp hackers: (defun buffer-mode (buffer) =22Return the major mode associated with BU=46= =46ER.=22 (buffer-local-value =E2=80=98major-mode buffer)) =20 Trivial, but useful. -- =20 Cheers, Bozhidar --52692d13_4b588f54_41c Content-Type: text/html; charset="utf-8" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline
I=E2=80=99ve seen the= following code used hundreds of times:

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

= or

(with-cu= rrent-buffer buffer =E2=80=98major-mode)

Why don=E2=80=99t we add the following function to Emacs and simplify a = bit the lives of Elisp hackers:

<=
span class=3D=22opn=22 style=3D=22margin: 0px; padding: 0px; border: 0px;=
 vertical-align: baseline; background-color: transparent;=22>(defun buffer-mode (buffer)
  =22Return the major mode associated with BU=46=46ER.=
=22
  (b=
uffer-local-value =E2=80=98major-mode buffer))

= Trivial, but useful.

-- 
C= heers,
Bozhidar

--52692d13_4b588f54_41c--