[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: python-mode broken - zip and git issues
From: |
Tim Johnson |
Subject: |
Re: python-mode broken - zip and git issues |
Date: |
Sun, 1 Feb 2015 11:40:32 -0900 |
User-agent: |
Mutt/1.4.2.3i |
* 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