From mboxrd@z Thu Jan 1 00:00:00 1970 From: Stefan =?iso-8859-1?Q?Reich=F6r?= Subject: Re: [PATCH]: New Add defun org-mode-or-derived-mode-p Date: Mon, 05 Sep 2011 08:50:38 +0200 Message-ID: References: <871uvz56th.fsf@thinkpad.tsdh.de> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit Return-path: Received: from eggs.gnu.org ([140.186.70.92]:59265) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R0T1C-0006lU-GX for emacs-orgmode@gnu.org; Mon, 05 Sep 2011 02:50:55 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1R0T1B-0008Cd-H9 for emacs-orgmode@gnu.org; Mon, 05 Sep 2011 02:50:54 -0400 Received: from lo.gmane.org ([80.91.229.12]:39868) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R0T1B-0008CQ-BS for emacs-orgmode@gnu.org; Mon, 05 Sep 2011 02:50:53 -0400 Received: from list by lo.gmane.org with local (Exim 4.69) (envelope-from ) id 1R0T18-0002KX-RX for emacs-orgmode@gnu.org; Mon, 05 Sep 2011 08:50:50 +0200 Received: from 193.186.169.68 ([193.186.169.68]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Mon, 05 Sep 2011 08:50:50 +0200 Received: from stefan by 193.186.169.68 with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Mon, 05 Sep 2011 08:50:50 +0200 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: emacs-orgmode@gnu.org Tassilo Horn writes: > Stefan Reichör writes: > >> +(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)) > > The if is superfluous. And instead of a new function, I'd rather add an > optional `derived' parameter to `org-mode-p'. (derived-mode-p 'org-mode) returns either 'org-mode or nil The reason for the if is, that (org-mode-p) returns either t or nil The optional derived parameter for org-mode-p is a good idea. Going one step further I think that using a strict parameter would be even better. Because I think that org-mode-p should also return t in derived modes. Only in some rare cases (org-mode-p t) can be used to allow a strict org-mode check. I'd like to preper a patch. Please tell me, if I should use the derived or the strict parameter. Thanks, Stefan.