From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: daniela-spit@gmx.it Newsgroups: gmane.emacs.help Subject: Re: Removing line and column number settings from some buffers Date: Sat, 5 Dec 2020 05:42:33 +0100 Message-ID: References: <87czzq9xq5.fsf@web.de> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="32665"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Michael Heerdegen , help-gnu-emacs@gnu.org To: Jean Louis Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Sat Dec 05 05:43:48 2020 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1klPQB-0008Pj-Ul for geh-help-gnu-emacs@m.gmane-mx.org; Sat, 05 Dec 2020 05:43:48 +0100 Original-Received: from localhost ([::1]:57650 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1klPQA-00089A-Vj for geh-help-gnu-emacs@m.gmane-mx.org; Fri, 04 Dec 2020 23:43:47 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:57028) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1klPPe-00088p-7x for help-gnu-emacs@gnu.org; Fri, 04 Dec 2020 23:43:14 -0500 Original-Received: from mout.gmx.net ([212.227.17.21]:37971) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1klPPX-0001Ma-VT for help-gnu-emacs@gnu.org; Fri, 04 Dec 2020 23:43:14 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1607143353; bh=tRlKuZe41T7ayaIsXcFQ5JmjdjyPl3YM74abyjdKusQ=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date:In-Reply-To:References; b=L/QnkUg90NVscwHwj+PdRj1tlEM+vtjb39vuMuY98kKdx0XMwsh5Ogt1nx0WkLnXw vSv8W4WmQ8dfqLlu9RWMRcmT5Y4k0gVJ4ZJL6mW0JQIJqa6qgnL9lcmScvKWjNMp69 jrv6h0pgrRfc2sas9oFqyYK459RZGigJqiciMPgE= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Original-Received: from [213.165.168.94] ([213.165.168.94]) by web-mail.gmx.net (3c-app-mailcom-bs04.server.lan [172.19.170.170]) (via HTTP); Sat, 5 Dec 2020 05:42:33 +0100 Importance: normal Sensitivity: Normal In-Reply-To: X-UI-Message-Type: mail X-Priority: 3 X-Provags-ID: V03:K1:FDvkjbgBrAIT2p2e+SLCAhCuMcTXBNcf+Af0uogPRNw9QApjWo/HHvvcZjEarVsHklnbT y24lyZY1QB7w8t5Gp564W3XMUBZl89mYq+3Z06N/xI4AGTO7yps/yD8SwncSdrAl9y/zCywgyvCW +kWDdJbNvkfXgfz2/cx8wgO09q3L4UkNPJ05Yc+UrSPyPGrJ7Lk+Y51hvZbDiLgTNoQK5A2wZC3A +uhqW8WADxrq35/b5wWVzJtutdH84WykTJRv1E5FV7zkVA20S+ZgVG67ygFFdfgY6amxbItcZfTz eM= X-UI-Out-Filterresults: notjunk:1;V03:K0:cvlN/GvRuiQ=:lHAaAMNMd8mPjjA8o5X9vq suBu78mZRWo0V5ngeUnkVwiZBxxMqSYudJTntgbaidgQgrNfMfn/IIKc4/VSS/QJsAJ5ePVoA R5wA+FvLrszU5viiG6ZzIzpeAkiJHrvGT7jnm7tZd2WL+0JMbc0k1O6hyl+2hHHDO/6fdnuMs zpJ3UYWfCvK455bCfEMsudQABKZHisBVyBLe0X8rfVvuQQxobkTbV37O5RJOr2MgwoAh65D8j 5opEasZ/BMXvLgQm5/ppNpvVYtquHttnbnYno6qtxCIr0g0EwLGB71wOVWgD16Urlk1UfScb6 8I2CmwupNaEVzLJmt0XVCGBbd16WW9CDEta7/QLSoCUJ0GtkwBIngl2T4dgFK/jF3ArqyQi/0 CXoHDCyB0BgJd5Z3jjVq1/bsh655rmGlbm63GhQsKNn26+45WCMC3y9Grn7fmhJKekEycMs6K u/KRsnAhNDld5tkPFlWZibi9ES5lYobDErII3j5mGjynyDrU/MY/pYGX9qS9DPYzjRzMirXga 8cfMqUMdgBgLSa3uGE5P+fpfVtzGfTN5g3biejCRB9+K9Otm5fPkzy+E+TK7jaksF1iwGRYcP LYU1GSu/irzeA= Received-SPF: pass client-ip=212.227.17.21; envelope-from=daniela-spit@gmx.it; helo=mout.gmx.net X-Spam_score_int: -25 X-Spam_score: -2.6 X-Spam_bar: -- X-Spam_report: (-2.6 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.23 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-mx.org@gnu.org Original-Sender: "help-gnu-emacs" Xref: news.gmane.io gmane.emacs.help:126001 Archived-At: Have tried using your suggestion. The file is being created with the correct information. However, when the code gets to option 3, the Mode Line is not being reverted to its original state. Daniela (defun change-mode-line (n) "Toggles Mode Line Information." (make-local-variable 'mode-line-position) (make-local-variable 'line-number-mode) (make-local-variable 'column-number-mode) (make-local-variable 'mode-line-modes) (make-local-variable 'mode-line-format) (make-local-variable 'original-mode-line-format) (make-local-variable 'mode-line-format) (cond ((=3D n 1) ;; Store current value of mode-line-format (setq original-mode-line-format mode-line-format) (data-to-file mode-line-format "~/.emacs.d/mode-line-frmt.el") (setq mode-line-position nil) (setq line-number-mode nil) (setq column-number-mode nil) (setq mode-line-modes nil) ;; Set format and discard System Load Averages indicator (setq display-time-format "W%W %H:%M") (make-local-variable 'display-time-default-load-average) (setq display-time-default-load-average nil) (display-time)) ((=3D n 2) (setq display-time-format "W%W %H:%M %a %b %d %Y") (display-time)) ((=3D n 3) ;; Put original mode-line-format (message "Doing 3") ;(setq mode-line-position t) ;(setq line-number-mode t) ;(setq column-number-mode t) ;(setq mode-line-modes t) ;(make-local-variable 'display-time-default-load-average) ;(setq display-time-default-load-average t) ;(display-time) (setq mode-line-format (data-from-file "~/.emacs.d/mode-line-frmt.el")) ))) (defun time-frmt-cycle () (interactive) (unless (get 'time-frmt-cycle 'state) (put 'time-frmt-cycle 'state 1)) (setq n (get 'time-frmt-cycle 'state)) (when (=3D n 1) (change-mode-line 1) (put 'time-frmt-cycle 'state 2)) (when (=3D n 2) (change-mode-line 2) (put 'time-frmt-cycle 'state 3)) (when (=3D n 3) (message "3") (change-mode-line 3) (put 'time-frmt-cycle 'state 1)) ) (global-set-key (kbd "H-i H-i") #'time-frmt-cycle) > Sent: Friday, December 04, 2020 at 8:19 AM > From: "Jean Louis" > To: daniela-spit@gmx.it > Cc: "Christopher Dimech" , "Michael Heerdegen" , help-gnu-emacs@gnu.org > Subject: Re: Removing line and column number settings from some buffers > > (make-local-variable 'anything-here) will work, but toggle-mode-line > is function and not variable > > * daniela-spit@gmx.it [2020-12-04 08:58]: > > There is something wrong in resetting the mode line, after trying to s= ave the > > original value. Michael has said that code only works if evaluated in= a buffer. > > > > Would there be some other call to use? > > > > (defun toggle-mode-line (n) > > "Changes Mode Line Information." > > > > (make-local-variable 'mode-line-position) > > (make-local-variable 'line-number-mode) > > (make-local-variable 'column-number-mode) > > (make-local-variable 'mode-line-modes) > > (make-local-variable 'mode-line-format) > > (make-local-variable 'original-mode-line-format) > > (make-local-variable 'mode-line-format) > > > > (cond > > ((=3D n 1) > > ;; Store current value of mode-line-format > > (setq original-mode-line-format mode-line-format) > > > > (setq mode-line-position nil) > > (setq line-number-mode nil) > > (setq column-number-mode nil) > > (setq mode-line-modes nil) > > > > ;; Set format and discard System Load Averages indicator > > (setq display-time-format "W%W %H:%M") > > (make-local-variable 'display-time-default-load-average) > > (setq display-time-default-load-average nil) > > > > (display-time)) > > > > ((=3D n 2) > > (setq display-time-format "W%W %H:%M %a %b %d %Y") > > (display-time)) > > > > ((=3D n 3) > > ;; Put original mode-line-format > > (setq mode-line-position t) > > (setq line-number-mode t) > > (setq column-number-mode t) > > (setq mode-line-modes t) > > > > (setq mode-line-format original-mode-line-format) > > (force-mode-line-update)) )) > > > > (make-local-variable 'toggle-mode-line) >