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 12:21:26 -0700 Message-ID: References: <87iov1vnd2.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 1386360518 18301 80.91.229.3 (6 Dec 2013 20:08:38 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 6 Dec 2013 20:08:38 +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 Fri Dec 06 21:08:43 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 1Vp1hY-000604-TZ for geh-help-gnu-emacs@m.gmane.org; Fri, 06 Dec 2013 21:08:41 +0100 Original-Received: from localhost ([::1]:33283 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Vp1hY-0002zI-Dc for geh-help-gnu-emacs@m.gmane.org; Fri, 06 Dec 2013 15:08:40 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:50790) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Vp0xw-0006D4-1M for help-gnu-emacs@gnu.org; Fri, 06 Dec 2013 14:21:33 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Vp0xu-0007tf-VM for help-gnu-emacs@gnu.org; Fri, 06 Dec 2013 14:21:31 -0500 Original-Received: from mail-ve0-x232.google.com ([2607:f8b0:400c:c01::232]:39327) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Vp0xu-0007tJ-Ov for help-gnu-emacs@gnu.org; Fri, 06 Dec 2013 14:21:30 -0500 Original-Received: by mail-ve0-f178.google.com with SMTP id c14so1269640vea.23 for ; Fri, 06 Dec 2013 11:21:26 -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=ca8Ecoz5/BoqJAtdCX/cIMOieP5WmUIMF5XffwRexGY=; b=nfR8iZ/iatqGeb/WK9naTSs7lBwxJxPJ1vDHDHkJxIWBWkEM8hk7V9ogFPNvy7037d QrrnMKsaF5z3vTndojd7updqqi9cxT1jI9VD352pNC4ZtpBogXQk7F1vRmsA08qVaOLq rYZqiypVwx56Hx+0rf8FTLKFQewYucdVi6irKJMMkcngCp9gz3GBo14PjBtlnKJqZY2s xxr9HSKgT68d/w5z3KEvGm25yj4TALP8WzYuq/+nJpKTQNWKlVrMVK9dibY0is4EBc9m FWcxUbH18eUV9cXw7FY3mvpP6WV9VkD6UqJY8TkwJ8Nzq+3vH8F6ruXd/RtOAABfEYLz tUmw== X-Received: by 10.58.49.169 with SMTP id v9mr28045ven.64.1386357686705; Fri, 06 Dec 2013 11:21:26 -0800 (PST) Original-Received: by 10.59.9.98 with HTTP; Fri, 6 Dec 2013 11:21:26 -0800 (PST) In-Reply-To: <87iov1vnd2.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:400c:c01::232 X-Mailman-Approved-At: Fri, 06 Dec 2013 15:08:29 -0500 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:94857 Archived-At: On Fri, Dec 6, 2013 at 11:35 AM, Emanuel Berg wrote: > Wes James writes: > > > I have these lines in my .emacs, but they don't > > work. Why? > > (interactive), for starters. But you probably won't to > enable this buffer-local. Also, check out the below > Elisp for two simple "toggle" defuns - you don't need > one to turn it off, and one to turn it on - think of it > as a binary state machine (i.e., with two states). It > only requires one operation, "do whatever I don't do > know". > > ;;; show point position > ;; column > (defun char-mode () > "Mode bar: Show the index of the character at point (first = 0)." > (interactive) > (set-variable 'column-number-mode > (not column-number-mode) > t) ) ; local > (defalias 'cols 'char-mode) > ;; line > (defun line-mode () > "Mode bar: Show the line number at point (first = 1)." > (interactive) > (set-variable 'line-number-mode > (not line-number-mode) > t) ) ; local > (defalias 'lines 'line-mode) > > -- > Emanuel Berg, programmer-for-rent. CV, projects, etc at uXu > underground experts united: http://user.it.uu.se/~embe8573 > Thank you. I appreciate this. -wes