From: Cassio Koshikumo <ckoshikumo@gmail.com>
To: Tassilo Horn <tassilo@member.fsf.org>
Cc: emacs-orgmode@gnu.org, Carsten Dominik <carsten.dominik@gmail.com>
Subject: Re: [PATCH]: New Add defun org-mode-or-derived-mode-p
Date: Thu, 03 Nov 2011 19:35:01 -0200 [thread overview]
Message-ID: <m2vcr0dh4q.wl%ckoshikumo@gmail.com> (raw)
In-Reply-To: <874nz1jrti.fsf@gnu.org>
Hi, all,
On the last few days I've been working on a major mode derived from org-mode.
While I was at it, I've encoutered some difficulties related to those reported
by the OP (Stefan). Specifically: in a lot of places, org-mode will check if
it's the current major-mode and, if it's not, will refuse to perform some
important task.
But this poses a problem: a derived mode will always fail the test
(eq major-mode 'org-mode)
So, as long as org-mode relies on this test to perform some tasks, a derived
mode will have non-functional pieces and bugs.
Before this patch, all the checking was centralized in the defsubst
`org-mode-p'. While I was developing my mode, I just changed it to
(defsubst org-mode-p ()
(derived-mode-p 'org-mode))
Of course, this was just a temporary workaround, but I was actually planning on
submitting a patch that implemented the (already discussed)
`org-mode-or-derived-mode-p' alternative, replacing all calls to `org-mode-p'
with calls to it.
But then comes this patch, which removes `org-mode-p' altogether. So, now, there
are several instances of the always-failing test on the code. Clearly, this is a
big problem for anyone writing derived modes (there doesn't seem to be a lot of
people doing that, but still).
So, finally, here's my question: would it be possible to change all the (eq
major-mode 'org-mode) tests and replace them with (derived-mode-p 'org-mode)? Is
there any reason not to do this?
That's effectively what happened when I changed the defsubst and I haven't
noticed any problems. After all, org-mode will continue to always pass that test
-- it's just that the derived modes will start to pass it too.
If no ones' against it, I think I could create the patch. I haven't signed the
FSF papers, but this change falls neatly into the "repetitive" category.
Cheers,
--
Cássio Koshikumo
At Sat, 22 Oct 2011 11:31:21 +0200,
Bastien wrote:
>
> Hi Tassilo,
>
> Tassilo Horn <tassilo@member.fsf.org> writes:
>
> > Ups, I've slightly misread your suggestion. Currently, there is only
> > one place in org-src.el that check for being a mode derived from
> > org-mode or org-mode itself. The second is useless, because
> > (derived-mode-p 'org-mode) is true for org-mode, too.
> >
> > But as I've said, I've misread your suggestion and made a patch that
> > completely erases org-mode-p and all its calls. Feel free to apply or
> > discard it. :-)
>
> I applied this patch -- thanks for it.
>
> IMHO another reason for using (eq major-mode 'org-mode) instead of
> (org-mode-p) is that new contributors are likely to use this more
> explicit (though longer) expression before they find out that a
> defsubst is available for that.
>
> --
> Bastien
>
>
next prev parent reply other threads:[~2011-11-03 21:40 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
2011-10-11 7:18 ` Tassilo Horn
2011-10-22 9:31 ` Bastien
2011-11-03 21:35 ` Cassio Koshikumo [this message]
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=m2vcr0dh4q.wl%ckoshikumo@gmail.com \
--to=ckoshikumo@gmail.com \
--cc=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 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).