emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: "Stefan Reichör" <stefan@xsteve.at>
To: emacs-orgmode@gnu.org
Subject: Re: [PATCH]: New Add defun org-mode-or-derived-mode-p
Date: Mon, 05 Sep 2011 08:50:38 +0200	[thread overview]
Message-ID: <m0r53vh48x.fsf@ge-research.com> (raw)
In-Reply-To: 871uvz56th.fsf@thinkpad.tsdh.de

Tassilo Horn <tassilo@member.fsf.org> writes:

> Stefan Reichör <stefan@xsteve.at> 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.

  reply	other threads:[~2011-09-05  6:50 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 [this message]
2011-09-05  7:36     ` Tassilo Horn
2011-10-06  8:20       ` Carsten Dominik
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

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m0r53vh48x.fsf@ge-research.com \
    --to=stefan@xsteve.at \
    --cc=emacs-orgmode@gnu.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 public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).