[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: python-mode broken - zip and git issues

From: Drew Adams
Subject: RE: python-mode broken - zip and git issues
Date: Sun, 1 Feb 2015 12:34:31 -0800 (PST)

> 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.


* 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'.  

reply via email to

[Prev in Thread] Current Thread [Next in Thread]