From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Robert Thorpe" Newsgroups: gmane.emacs.help Subject: Re: How to apply a minor mode to all buffers Date: 23 Jan 2007 09:48:47 -0800 Organization: http://groups.google.com Message-ID: <1169574527.698236.9970@s48g2000cws.googlegroups.com> 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 Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" X-Trace: sea.gmane.org 1169577633 4783 80.91.229.12 (23 Jan 2007 18:40:33 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Tue, 23 Jan 2007 18:40:33 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Tue Jan 23 19:40:26 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 1H9QZE-0003Eb-Qx for geh-help-gnu-emacs@m.gmane.org; Tue, 23 Jan 2007 19:40:25 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1H9QZE-00044b-D7 for geh-help-gnu-emacs@m.gmane.org; Tue, 23 Jan 2007 13:40:24 -0500 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!postnews.google.com!s48g2000cws.googlegroups.com!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 37 Original-NNTP-Posting-Host: 163.244.62.65 Original-X-Trace: posting.google.com 1169574534 16411 127.0.0.1 (23 Jan 2007 17:48:54 GMT) Original-X-Complaints-To: groups-abuse@google.com Original-NNTP-Posting-Date: Tue, 23 Jan 2007 17:48:54 +0000 (UTC) In-Reply-To: User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.10) Gecko/20050716 Firefox/1.0.6,gzip(gfe),gzip(gfe) X-HTTP-Via: 1.0 EMF1ASPROXY03 Complaints-To: groups-abuse@google.com Injection-Info: s48g2000cws.googlegroups.com; posting-host=163.244.62.65; posting-account=hWoAPxMAAAAnBKSBz1ZivwUPPjEuve7bvVCHZQ8rhrluPfwcBJd92w Original-Xref: shelby.stanford.edu gnu.emacs.help:144954 Original-To: help-gnu-emacs@gnu.org 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:40559 Archived-At: Eli Zaretskii wrote: > > 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. Sure, I once did something similar in .emacs. It's not exactly friendly to beginners who might want to do this though. Feel free to ignore my suggestion for until I send you a patch, which might be never.