From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Emanuel Berg Newsgroups: gmane.emacs.help Subject: Re: turning line mode on/off with defun not working Date: Fri, 06 Dec 2013 22:35:23 +0100 Organization: Aioe.org NNTP Server Message-ID: <87ppp93bnv.fsf@nl106-137-194.student.uu.se> References: <87iov1vnd2.fsf@nl106-137-194.student.uu.se> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1386366014 15211 80.91.229.3 (6 Dec 2013 21:40:14 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 6 Dec 2013 21:40:14 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Fri Dec 06 22:40:22 2013 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 1Vp38H-000100-CD for geh-help-gnu-emacs@m.gmane.org; Fri, 06 Dec 2013 22:40:21 +0100 Original-Received: from localhost ([::1]:33595 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Vp38G-0003HO-QW for geh-help-gnu-emacs@m.gmane.org; Fri, 06 Dec 2013 16:40:20 -0500 Original-Path: usenet.stanford.edu!news.tele.dk!news.tele.dk!small.news.tele.dk!newsgate.cistron.nl!newsgate.news.xs4all.nl!194.109.133.83.MISMATCH!newsfeed.xs4all.nl!newsfeed4.news.xs4all.nl!xs4all!news.stack.nl!aioe.org!.POSTED!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 37 Original-NNTP-Posting-Host: VVbyYd/iFZoeWNmD9i++cQ.user.speranza.aioe.org Original-X-Complaints-To: abuse@aioe.org User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.4 (gnu/linux) X-Notice: Filtered by postfilter v. 0.8.2 Cancel-Lock: sha1:5DbJ0oEqDARHHXD/tlIWWNSbemw= Mail-Copies-To: never Original-Xref: usenet.stanford.edu gnu.emacs.help:202590 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:94859 Archived-At: Wes James writes: > Thank you. I appreciate this. In that case, let me tell you some more. Those interactive defuns are handy for situations unforeseen, when you suddenly need them. But for certain modes, you know you always want it (or you know you never want it). In those cases you can set (or unset) automatically upon invocation, with hooks. Those hooks do the job for you in 99% of the cases, and in the 1% case, you still have those interactive defuns to set it manually. So to enable line-number-mode for C and C++ programming, it may look like this: (setq c-mode-hook 'lines) (setq c++-mode-hook (lambda () (lines) (abbrev-mode 0))) In C++, I also disable abbrev-mode (for some reason), but it is only a good thing because as you see, enabling line-number-mode looks somewhat different. Note that the above are for my lines stuff - to use the actual functions directly, probably you need (lambda () (line-number-mode 1)) for the modes where you want it. Also, those hooks can be examined like any variables. You can examine your hooks with C-h v, and if they are not nil, instead of setq (so not to overwrite what's there), use add-hook (and then *quote* the mode, like this 'c-mode-hook). -- Emanuel Berg, programmer-for-rent. CV, projects, etc at uXu underground experts united: http://user.it.uu.se/~embe8573