From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.help Subject: Re: How to apply a minor mode to all buffers Date: Mon, 22 Jan 2007 23:23:29 +0200 Message-ID: References: <877ivkjb66.fsf@trick.ulm.malte.spiess> <1169314688.257876.13620@q2g2000cwa.googlegroups.com> <1169466510.208240.112060@51g2000cwl.googlegroups.com> NNTP-Posting-Host: lo.gmane.org X-Trace: sea.gmane.org 1169501196 5139 80.91.229.12 (22 Jan 2007 21:26:36 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Mon, 22 Jan 2007 21:26:36 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Mon Jan 22 22:26:28 2007 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1H96dl-000762-Fg for geh-help-gnu-emacs@m.gmane.org; Mon, 22 Jan 2007 22:23:45 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1H96dl-0003lh-0a for geh-help-gnu-emacs@m.gmane.org; Mon, 22 Jan 2007 16:23:45 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1H96dZ-0003kj-6u for help-gnu-emacs@gnu.org; Mon, 22 Jan 2007 16:23:33 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1H96dY-0003kA-95 for help-gnu-emacs@gnu.org; Mon, 22 Jan 2007 16:23:32 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1H96dY-0003k7-4K for help-gnu-emacs@gnu.org; Mon, 22 Jan 2007 16:23:32 -0500 Original-Received: from [213.8.233.22] (helo=nitzan.inter.net.il) by monty-python.gnu.org with esmtp (Exim 4.52) id 1H96dX-0002h2-D1 for help-gnu-emacs@gnu.org; Mon, 22 Jan 2007 16:23:31 -0500 Original-Received: from HOME-C4E4A596F7 (IGLD-83-130-248-28.inter.net.il [83.130.248.28]) by nitzan.inter.net.il (MOS 3.7.3a-GA) with ESMTP id FVU62546 (AUTH halo1); Mon, 22 Jan 2007 23:23:22 +0200 (IST) Original-To: help-gnu-emacs@gnu.org In-reply-to: <1169466510.208240.112060@51g2000cwl.googlegroups.com> (rthorpe@realworldtech.com) X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:40537 Archived-At: > From: "Robert Thorpe" > Date: 22 Jan 2007 03:48:30 -0800 > > The after-change-mode-hook is still quite tedious. > Let's say you want to enable hide-show mode in every mode in which it's > useful. Generally it's only useful in programming language modes and a > few text modes, currently the only way to accurately do this is to > enable it individually in many hooks. Here's a simple solution to a similar problem I have in my .emacs for quite some time: ;;; Turn on trailing whitespace highlighting in modes where ;;; it makes sense. (let* ((twh-modes '("texinfo-mode" "makefile-mode" "c-mode-common" "emacs-lisp-mode" "outline-mode" "sh-mode" "shell-script-mode" )) (elt (car twh-modes))) (while elt (add-hook (intern (concat elt "-hook")) (function (lambda () (setq show-trailing-whitespace t)))) (setq twh-modes (cdr twh-modes) elt (car twh-modes)))) If I ever need to do that in an additional mode, all I have to do is add another mode name to the list at the beginning of this snippet: hardly a tedious job.