From mboxrd@z Thu Jan 1 00:00:00 1970 From: Carsten Dominik Subject: Re: [PATCH]: New Add defun org-mode-or-derived-mode-p Date: Thu, 6 Oct 2011 10:20:23 +0200 Message-ID: <61054BA2-E0B8-40B9-B62E-FB0EB04E99CF@gmail.com> References: <871uvz56th.fsf@thinkpad.tsdh.de> <87wrdnigpd.fsf@thinkpad.tsdh.de> Mime-Version: 1.0 (Apple Message framework v1084) Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([140.186.70.92]:59446) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RBjBu-00019C-3B for emacs-orgmode@gnu.org; Thu, 06 Oct 2011 04:20:31 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RBjBq-0005c5-03 for emacs-orgmode@gnu.org; Thu, 06 Oct 2011 04:20:30 -0400 Received: from mail-ey0-f169.google.com ([209.85.215.169]:37405) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RBjBp-0005br-Rr for emacs-orgmode@gnu.org; Thu, 06 Oct 2011 04:20:25 -0400 Received: by eye13 with SMTP id 13so2736857eye.0 for ; Thu, 06 Oct 2011 01:20:25 -0700 (PDT) In-Reply-To: <87wrdnigpd.fsf@thinkpad.tsdh.de> List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Tassilo Horn Cc: emacs-orgmode@gnu.org On Sep 5, 2011, at 9:36 AM, Tassilo Horn wrote: > Stefan Reich=F6r writes: >=20 > Hi Stefan, >=20 >>>> +(defun org-mode-or-derived-mode-p () >>>> + "Check if the current buffer is in Org-mode or a derived mode." >>>> + (if (derived-mode-p 'org-mode) t nil)) >>>=20 >>> The if is superfluous. And instead of a new function, I'd rather = add an >>> optional `derived' parameter to `org-mode-p'. >>=20 >> (derived-mode-p 'org-mode) returns either 'org-mode or nil >>=20 >> The reason for the if is, that (org-mode-p) returns either t or nil >=20 > Yes, but from an elisp perspective, 'org-mode is as true as t. >=20 > BTW: I'm not sure if there is any reasonable benefit for `org-mode-p', > anyway. Checking the rest of the emacs source tree, then the = convention > is to either use >=20 > (eq major-mode 'foo-mode) >=20 > or >=20 > (derived-mode-p 'foo-mode) >=20 > depending on what's needed. I don't see why (org-mode-p) or even > (org-mode-p 'derived) is clearer... I agree, it is not clearer, only a bit more compact. I don't think we should have a new function here. Just make a patch that used derived-mode-p in places where this is needed. I would accept such a patch. - Carsten