[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [O] [PATCH]: New Add defun org-mode-or-derived-mode-p
From: |
Stefan Reichör |
Subject: |
Re: [O] [PATCH]: New Add defun org-mode-or-derived-mode-p |
Date: |
Mon, 05 Sep 2011 08:50:38 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux) |
Tassilo Horn <address@hidden> writes:
> Stefan Reichör <address@hidden> 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.