Stefan Reichör <ste...@xsteve.at> writes:

Hi Stefan,

>>> +(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

Yes, but from an elisp perspective, 'org-mode is as true as t.

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

  (eq major-mode 'foo-mode)

or

  (derived-mode-p 'foo-mode)

depending on what's needed.  I don't see why (org-mode-p) or even
(org-mode-p 'derived) is clearer...

Bye,
Tassilo


Reply via email to