From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Tim Johnson Newsgroups: gmane.emacs.help Subject: Re: python-mode broken - zip and git issues Date: Sun, 1 Feb 2015 11:40:32 -0900 Organization: AkWebsoft Message-ID: <20150201204032.GB911@mail.akwebsoft.com> References: <20150131203933.GK1459@mail.akwebsoft.com> <20150131205613.GL1459@mail.akwebsoft.com> <7f9babbe-2b1f-417a-bcff-0e67d5865db2@default> <20150131222354.GM1459@mail.akwebsoft.com> <20150201202313.GA911@mail.akwebsoft.com> <34001ff4-02a9-4102-93a0-5240aad40d75@default> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1422823261 10445 80.91.229.3 (1 Feb 2015 20:41:01 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 1 Feb 2015 20:41:01 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sun Feb 01 21:41:01 2015 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1YI1KG-0000oZ-5r for geh-help-gnu-emacs@m.gmane.org; Sun, 01 Feb 2015 21:41:00 +0100 Original-Received: from localhost ([::1]:51866 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YI1KF-0006EJ-H7 for geh-help-gnu-emacs@m.gmane.org; Sun, 01 Feb 2015 15:40:59 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:34648) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YI1Jy-0006D9-GM for help-gnu-emacs@gnu.org; Sun, 01 Feb 2015 15:40:47 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YI1Jt-0004hi-OR for help-gnu-emacs@gnu.org; Sun, 01 Feb 2015 15:40:42 -0500 Original-Received: from 191-232-4-64.mtaonline.net ([64.4.232.191]:49858 helo=tj49.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YI1Jt-0004ge-4d for help-gnu-emacs@gnu.org; Sun, 01 Feb 2015 15:40:37 -0500 Original-Received: by tj49.com (Postfix, from userid 501) id 894C859D76D7; Sun, 1 Feb 2015 11:40:32 -0900 (AKST) Mail-Followup-To: help-gnu-emacs@gnu.org Content-Disposition: inline In-Reply-To: <34001ff4-02a9-4102-93a0-5240aad40d75@default> User-Agent: Mutt/1.4.2.3i X-detected-operating-system: by eggs.gnu.org: Mac OS X 10.x X-Received-From: 64.4.232.191 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:102440 Archived-At: * Drew Adams [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