On Sep 5, 2011, at 9:36 AM, Tassilo Horn wrote: > 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...
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