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: Tue, 23 Jan 2007 23:56:50 +0200 Message-ID: References: <877ivkjb66.fsf@trick.ulm.malte.spiess> <1169314688.257876.13620@q2g2000cwa.googlegroups.com> <1169466510.208240.112060@51g2000cwl.googlegroups.com> <1169574527.698236.9970@s48g2000cws.googlegroups.com> Reply-To: Eli Zaretskii NNTP-Posting-Host: lo.gmane.org X-Trace: sea.gmane.org 1169589451 18019 80.91.229.12 (23 Jan 2007 21:57:31 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Tue, 23 Jan 2007 21:57:31 +0000 (UTC) Cc: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Tue Jan 23 22:57:23 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 1H9Tdr-0002T7-7A for geh-help-gnu-emacs@m.gmane.org; Tue, 23 Jan 2007 22:57:23 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1H9Tdq-0007n9-QW for geh-help-gnu-emacs@m.gmane.org; Tue, 23 Jan 2007 16:57:22 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1H9Tde-0007mm-IX for help-gnu-emacs@gnu.org; Tue, 23 Jan 2007 16:57:10 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1H9Tdc-0007m7-Pf for help-gnu-emacs@gnu.org; Tue, 23 Jan 2007 16:57:10 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1H9Tdc-0007m4-Ms for help-gnu-emacs@gnu.org; Tue, 23 Jan 2007 16:57:08 -0500 Original-Received: from [213.8.233.24] (helo=romy.inter.net.il) by monty-python.gnu.org with esmtp (Exim 4.52) id 1H9Tdc-00019l-5Y for help-gnu-emacs@gnu.org; Tue, 23 Jan 2007 16:57:08 -0500 Original-Received: from HOME-C4E4A596F7 (IGLD-84-228-5-206.inter.net.il [84.228.5.206]) by romy.inter.net.il (MOS 3.7.3-GA) with ESMTP id GYC15677 (AUTH halo1); Tue, 23 Jan 2007 23:56:50 +0200 (IST) Original-To: "Robert Thorpe" In-reply-to: <1169574527.698236.9970@s48g2000cws.googlegroups.com> (rthorpe@realworldtech.com) X-detected-kernel: FreeBSD 4.7-5.2 (or MacOS X 10.2-10.4) (2) 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:40569 Archived-At: > From: "Robert Thorpe" > Date: 23 Jan 2007 09:48:47 -0800 > > > > ;;; 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. > > Sure, I once did something similar in .emacs. It's not exactly friendly > to beginners who might want to do this though. I doubt that beginners would think about such advanced customizations as the one that started this thread.