From: Carsten Dominik <carsten.dominik@gmail.com>
To: Tassilo Horn <tassilo@member.fsf.org>
Cc: emacs-orgmode@gnu.org
Subject: Re: [PATCH]: New Add defun org-mode-or-derived-mode-p
Date: Thu, 6 Oct 2011 10:20:23 +0200 [thread overview]
Message-ID: <61054BA2-E0B8-40B9-B62E-FB0EB04E99CF@gmail.com> (raw)
In-Reply-To: <87wrdnigpd.fsf@thinkpad.tsdh.de>
On Sep 5, 2011, at 9:36 AM, Tassilo Horn wrote:
> Stefan Reichör <stefan@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
next prev parent reply other threads:[~2011-10-06 8:20 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-09-02 11:09 [PATCH]: New Add defun org-mode-or-derived-mode-p Stefan Reichör
2011-09-02 14:59 ` Tassilo Horn
2011-09-05 6:50 ` Stefan Reichör
2011-09-05 7:36 ` Tassilo Horn
2011-10-06 8:20 ` Carsten Dominik [this message]
2011-10-11 7:18 ` Tassilo Horn
2011-10-22 9:31 ` Bastien
2011-11-03 21:35 ` Cassio Koshikumo
2011-11-06 15:11 ` David Maus
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=61054BA2-E0B8-40B9-B62E-FB0EB04E99CF@gmail.com \
--to=carsten.dominik@gmail.com \
--cc=emacs-orgmode@gnu.org \
--cc=tassilo@member.fsf.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.