From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Wes James Newsgroups: gmane.emacs.help Subject: Re: turning line mode on/off with defun not working Date: Fri, 6 Dec 2013 16:05:06 -0700 Message-ID: References: <87iov1vnd2.fsf@nl106-137-194.student.uu.se> <87ppp93bnv.fsf@nl106-137-194.student.uu.se> <87lhzxodu5.fsf@nl106-137-194.student.uu.se> <8738m5sj39.fsf@nl106-137-194.student.uu.se> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 X-Trace: ger.gmane.org 1386371504 10147 80.91.229.3 (6 Dec 2013 23:11:44 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 6 Dec 2013 23:11:44 +0000 (UTC) Cc: help-gnu-emacs@gnu.org To: Emanuel Berg Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sat Dec 07 00:11:50 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 1Vp4Yo-0003Yu-JL for geh-help-gnu-emacs@m.gmane.org; Sat, 07 Dec 2013 00:11:50 +0100 Original-Received: from localhost ([::1]:33824 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Vp4Yo-0005Cp-4d for geh-help-gnu-emacs@m.gmane.org; Fri, 06 Dec 2013 18:11:50 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:40619) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Vp4Yc-0005Ck-6d for help-gnu-emacs@gnu.org; Fri, 06 Dec 2013 18:11:39 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Vp4Ya-0007J4-P9 for help-gnu-emacs@gnu.org; Fri, 06 Dec 2013 18:11:38 -0500 Original-Received: from mail-ie0-x236.google.com ([2607:f8b0:4001:c03::236]:65194) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Vp4Ya-0007Iq-J8 for help-gnu-emacs@gnu.org; Fri, 06 Dec 2013 18:11:36 -0500 Original-Received: by mail-ie0-f182.google.com with SMTP id as1so2521594iec.13 for ; Fri, 06 Dec 2013 15:11:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=Qg7+Xzdaz0fc4TuFx3y5FOTuoVhtC8svgKS8b/iiuWo=; b=H/tEVp/kkVZRhCVrlQoKzFM+cL8GYryo+80WPfBepin1B108e0B++4fXeotoYTf/p0 Sk8Pj25NEw54ACFdJayKNKyPwrHvn0O+GvR/fA5LRkBd5QADETnIIAUonMFqFSt2wK2s xPqmbzoljCixSaokIWXwWsOznXf9KKQMeB5Oe+IBvdeGZqDyeUYPsrShnJD/G2JGigrN 4iuO0KyQ2BVP1kXo9fa/2XjwtkB6s5TVOWWLIJPY4NhlnziMIEcehHhlmgtHF3NssCZE OWm2jonhTcVJ9kxw7Au452utscOiehrK2M7Ynhe7bQES1rsPY9IjaI3SJ53AzXZQKRxT gGfg== X-Received: by 10.42.222.68 with SMTP id if4mr4240353icb.62.1386371106989; Fri, 06 Dec 2013 15:05:06 -0800 (PST) Original-Received: by 10.50.154.36 with HTTP; Fri, 6 Dec 2013 15:05:06 -0800 (PST) In-Reply-To: <8738m5sj39.fsf@nl106-137-194.student.uu.se> X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2607:f8b0:4001:c03::236 X-Content-Filtered-By: Mailman/MimeDel 2.1.14 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:94862 Archived-At: On Fri, Dec 6, 2013 at 3:35 PM, Emanuel Berg wrote: > Emanuel Berg writes: > > > No, that seems not to be local (?). Well, the way I did > > it with `lines' above, that works, so use that if you > > want it the way I describe it. > > This was a bit confusing: > > (line-number-mode 1) > (line-number-mode 0) > (set-variable 'line-number-mode t t) > (set-variable 'line-number-mode nil t) > > It would seem like the first two lines work on the > global scope, only, once you have run either of lines > three and four, the first two lines seem to work on the > local instance instead. Well, lines three and four work > on the *variable*, which they locally set to the given > value. In lines one and two, I just pass an argument 1 > or 0 to the *function*. I guess the correct place to > examine this would be that function (so there is a > mode, a function, *and* a variable with the same name) > and see if it somehow changes behaviour based on the > existence of a local instance, *or* if this is deeper > in the Emacs architecture: it wouldn't be a chock if > local instances take precedence. Well, perhaps someone > could tell us (me) straight off? > > Thanks for the mini tutorial. I was able to change the line on/off with: (defun lt() "Toggle line numbers on/off" (interactive) (global-linum-mode) ) I just do M-x and type "lt" to do line number toggling on and off. Bye the way, I've seen some code with (defun name "space" ().....) Should there be a space after the defun name or not for style recommendation? It seems to work either way: (defun name ()...) or (defun name()...) Thanks again, -wes