From: Tim Johnson <tim@akwebsoft.com>
To: help-gnu-emacs@gnu.org
Subject: Re: python-mode broken - zip and git issues
Date: Sun, 1 Feb 2015 11:40:32 -0900 [thread overview]
Message-ID: <20150201204032.GB911@mail.akwebsoft.com> (raw)
In-Reply-To: <34001ff4-02a9-4102-93a0-5240aad40d75@default>
* Drew Adams <drew.adams@oracle.com> [150201 11:35]:
> > Would there be anything wrong about a function like this:
> > (defun tj-check-mode (prefix)
> > "Test the major mode to see if the symbol begins with prefix.
> > The test is case insensitive."
> > (interactive)
> > (string-prefix-p prefix (symbol-name major-mode) 1))
> > ;; return t for major-mode 'python or 'python-mode
>
> No, nothing wrong with that.
>
> But:
>
> * Function names ending in `-mode' suggest mode functions.
> The convention for predicates is to use suffix `p' or
> `-p'. See (elisp) `Coding Conventions'.
>
> * You probably want the doc string to say that it returns
> non-nil if... Just saying that something tests something
> doesn't tell you how to understand the test result. ;-)
>
> * If you just want to check for those two modes then it
> is more correct to check membership:
> (memq major-mode '(python python-mode))
> That rules out returning non-nil for, say, `pythonesque'.
good tip on docstring
... and I've learned a new function (memq) as well as
distinguishing between eq and equal.
thanks again
--
Tim
tim at tee jay forty nine dot com or akwebsoft dot com
http://www.akwebsoft.com, http://www.tj49.com
next prev parent reply other threads:[~2015-02-01 20:40 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-01-31 20:39 python-mode broken - zip and git issues Tim Johnson
2015-01-31 20:56 ` Tim Johnson
2015-01-31 22:05 ` Drew Adams
2015-01-31 22:23 ` Tim Johnson
2015-02-01 14:38 ` Stefan Monnier
2015-02-01 15:51 ` Drew Adams
2015-02-01 17:08 ` Tim Johnson
2015-02-01 20:23 ` Tim Johnson
2015-02-01 20:34 ` Drew Adams
2015-02-01 20:40 ` Tim Johnson [this message]
2015-02-03 20:21 ` Stefan Monnier
2015-02-01 18:03 ` Andreas Röhler
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.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20150201204032.GB911@mail.akwebsoft.com \
--to=tim@akwebsoft.com \
--cc=help-gnu-emacs@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.
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).