From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: turn-on/off-*MODE* Date: Wed, 26 Sep 2012 17:47:25 -0400 Message-ID: References: <7CEBB461-93C5-4A30-B896-64A2C632367F@mit.edu> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1348696058 21768 80.91.229.3 (26 Sep 2012 21:47:38 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 26 Sep 2012 21:47:38 +0000 (UTC) Cc: emacs-devel@gnu.org To: chad Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Sep 26 23:47:44 2012 Return-path: Envelope-to: ged-emacs-devel@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 1TGzSJ-0004fF-ID for ged-emacs-devel@m.gmane.org; Wed, 26 Sep 2012 23:47:43 +0200 Original-Received: from localhost ([::1]:48212 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TGzSE-0006T2-J3 for ged-emacs-devel@m.gmane.org; Wed, 26 Sep 2012 17:47:38 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:35971) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TGzS8-0005oQ-JX for emacs-devel@gnu.org; Wed, 26 Sep 2012 17:47:36 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TGzS2-00029p-Gr for emacs-devel@gnu.org; Wed, 26 Sep 2012 17:47:32 -0400 Original-Received: from ironport2-out.teksavvy.com ([206.248.154.182]:1766) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TGzS2-00029j-Cd for emacs-devel@gnu.org; Wed, 26 Sep 2012 17:47:26 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Av0EAG6Zu09FxLT4/2dsb2JhbABEDrQDgQiCFQEBBAFWIwULCzQSFBgNJIgcBboJkEQDozOBWIIwVQ X-IronPort-AV: E=Sophos;i="4.75,637,1330923600"; d="scan'208";a="200066625" Original-Received: from 69-196-180-248.dsl.teksavvy.com (HELO fmsmemgm.homelinux.net) ([69.196.180.248]) by ironport2-out.teksavvy.com with ESMTP/TLS/ADH-AES256-SHA; 26 Sep 2012 17:47:25 -0400 Original-Received: by fmsmemgm.homelinux.net (Postfix, from userid 20848) id 7A9D7AE0AA; Wed, 26 Sep 2012 17:47:25 -0400 (EDT) In-Reply-To: <7CEBB461-93C5-4A30-B896-64A2C632367F@mit.edu> (chad's message of "Wed, 26 Sep 2012 14:36:04 -0700") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.2.50 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 206.248.154.182 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:153610 Archived-At: > Is there a general guideline for when to add or not add these? Yes: never add them. > + ;;;###autoload > + (defun turn-on-hl-line () > + "Unconditionally turn on highlight-line mode." > + (hl-line-mode 1)) (hl-line-mode) is the same as (hl-line-mode 1), so you can rewrite is as: ;;;###autoload (defun turn-on-hl-line () "Unconditionally turn on highlight-line mode." (hl-line-mode)) => ;;;###autoload (defalias 'turn-on-hl-line #'hl-line-mode "Unconditionally turn on highlight-line mode.") at which point you can decide it's not worth the trouble. > + ;;;###autoload > + (defun turn-off-hl-line () > + "Unconditionally turn off highlight-line mode." > + (hl-line-mode -1)) I've virtually never seen it used. So for the very rare cases (lambda () (foo-mode -1)) works just as well and isn't that much longer #'turn-off-foo-mode. Stefan