unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: daniela-spit@gmx.it
To: Christopher Dimech <dimech@gmx.com>
Cc: Michael Heerdegen <michael_heerdegen@web.de>, help-gnu-emacs@gnu.org
Subject: Re: Removing line and column number settings from some buffers
Date: Fri, 4 Dec 2020 06:58:11 +0100	[thread overview]
Message-ID: <trinity-0c9ec45c-4bc4-407f-b202-198151d253fe-1607061491881@3c-app-mailcom-bs11> (raw)
In-Reply-To: <trinity-ca472207-5795-418c-bcd9-627492103c8a-1607056587509@3c-app-mailcom-bs11>

There is something wrong in resetting the mode line, after trying to save 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
      ((= 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))

      ((= n 2)
         (setq display-time-format "W%W %H:%M %a %b %d %Y")
         (display-time))

      ((= 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)



> Sent: Friday, December 04, 2020 at 5:36 AM
> From: daniela-spit@gmx.it
> To: "Christopher Dimech" <dimech@gmx.com>
> Cc: "Michael Heerdegen" <michael_heerdegen@web.de>, help-gnu-emacs@gnu.org
> Subject: Re: Removing line and column number settings from some buffers
>
> One problem is how to store  (get 'time-frmt-cycle 'state) in a variable.
>
>
> > Sent: Friday, December 04, 2020 at 5:16 AM
> > From: daniela-spit@gmx.it
> > To: "Christopher Dimech" <dimech@gmx.com>
> > Cc: "Michael Heerdegen" <michael_heerdegen@web.de>, help-gnu-emacs@gnu.org
> > Subject: Re: Removing line and column number settings from some buffers
> >
> > Can somebody help me make a key binding that cycles
> > through a function (appt-mode-line n) where 'n' can
> > be 1, 2 or 3.
> >
> > Thank you
> > Daniela
> >
> > > Sent: Friday, December 04, 2020 at 3:10 AM
> > > From: daniela-spit@gmx.it
> > > To: "Christopher Dimech" <dimech@gmx.com>
> > > Cc: "Michael Heerdegen" <michael_heerdegen@web.de>, help-gnu-emacs@gnu.org
> > > Subject: Re: Removing line and column number settings from some buffers
> > >
> > >
> > >
> > > > Sent: Friday, December 04, 2020 at 2:33 AM
> > > > From: "Christopher Dimech" <dimech@gmx.com>
> > > > To: "Michael Heerdegen" <michael_heerdegen@web.de>, daniela-spit@gmx.it
> > > > Cc: help-gnu-emacs@gnu.org
> > > > Subject: Re: Removing line and column number settings from some buffers
> > > >
> > > >
> > > >
> > > >
> > > > > Sent: Friday, December 04, 2020 at 2:16 AM
> > > > > From: "Michael Heerdegen" <michael_heerdegen@web.de>
> > > > > To: help-gnu-emacs@gnu.org
> > > > > Subject: Re: Removing line and column number settings from some buffers
> > > > >
> > > > > Christopher Dimech <dimech@gmx.com> writes:
> > > > >
> > > > > > > > > (setq mode-line-format
> > > > > > > > >    (list
> > > > > > > > >       "%e"
> > > > > > > > >       " "
> > > > > > > > >       " "
> > > > > > > > >       'mode-line-modes       'mode-line-misc-info
> > > > > > > > >       'mode-line-end-spaces) )
> > > > > > > > >
> > > > > > > > > (force-mode-line-update)
> > > > > >
> > > > > > Have put the code in my init, and the mode line is also not being
> > > > > > updated.  Even after firing new Emacs Sessions.
> > > > >
> > > > > This does only modify the mode-line of the buffer that is current when
> > > > > that code is loaded, so this is expected.
> > > >
> > > > I see.  Have put it in a file and hit "M-x eval-region".  And then the change
> > > > happens.
> > >
> > > At least I say things changing.
> > >
> > > What I want to do is to change the Mode Line, but then revert back to how it
> > > was in that buffer, by continue pressing same keybinding.  Can I store the
> > > old setup and then put it back again.
> > >
> > > >
> > > > > Michael.
> > > > >
> > > > >
> > > > >
> > > >
> > > > ---------------------
> > > > Christopher Dimech
> > > > General Administrator - Naiad Informatics - GNU Project (Geocomputation)
> > > > - Geophysical Simulation
> > > > - Geological Subsurface Mapping
> > > > - Disaster Preparedness and Mitigation
> > > > - Natural Resource Exploration and Production
> > > > - Free Software Advocacy
> > > >
> > > >
> > >
> >
>



  reply	other threads:[~2020-12-04  5:58 UTC|newest]

Thread overview: 45+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-02 15:34 Removing line and column number settings from some buffers daniela-spit
2020-12-02 21:18 ` Emanuel Berg via Users list for the GNU Emacs text editor
2020-12-02 23:21   ` daniela-spit
2020-12-02 23:28     ` Emanuel Berg via Users list for the GNU Emacs text editor
2020-12-02 23:32       ` daniela-spit
2020-12-02 23:56         ` Emanuel Berg via Users list for the GNU Emacs text editor
2020-12-02 23:57         ` daniela-spit
2020-12-03  0:04           ` Emanuel Berg via Users list for the GNU Emacs text editor
2020-12-03 22:14           ` Michael Heerdegen
2020-12-03 22:19             ` daniela-spit
2020-12-03 22:22               ` Jean Louis
2020-12-03 22:33                 ` daniela-spit
2020-12-03 22:52                   ` Jean Louis
2020-12-03 23:09                     ` daniela-spit
2020-12-04  0:38                       ` Christopher Dimech
2020-12-04  1:16                         ` Michael Heerdegen
2020-12-04  1:33                           ` Christopher Dimech
2020-12-04  2:10                             ` daniela-spit
2020-12-04  2:42                               ` Christopher Dimech
2020-12-04  6:10                                 ` Jean Louis
2020-12-04  6:31                                   ` Christopher Dimech
2020-12-04  8:40                                   ` Eli Zaretskii
2020-12-05  5:13                                   ` Christopher Dimech
2020-12-05 15:41                                     ` Drew Adams
2020-12-05 17:58                                       ` Jean Louis
2020-12-05 18:16                                         ` Drew Adams
2020-12-05 18:57                                           ` Jean Louis
2020-12-04  2:46                               ` Michael Heerdegen
2020-12-04  3:12                                 ` Christopher Dimech
2020-12-04  4:16                               ` daniela-spit
2020-12-04  4:36                                 ` daniela-spit
2020-12-04  5:58                                   ` daniela-spit [this message]
2020-12-04  7:19                                     ` Jean Louis
2020-12-05  4:42                                       ` daniela-spit
2020-12-05 21:32                                         ` Michael Heerdegen
2020-12-05 21:35                                   ` Michael Heerdegen
2020-12-05 22:54                                     ` daniela-spit
2020-12-05 22:57                                       ` Drew Adams
2020-12-05 23:05                                         ` daniela-spit
2020-12-05 23:37                                           ` Drew Adams
2020-12-05 23:53                                             ` daniela-spit
2020-12-04  7:40                                 ` Jean Louis
2020-12-04  6:07                               ` Jean Louis
2020-12-03 23:24               ` Michael Heerdegen
2020-12-03 23:36                 ` daniela-spit

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=trinity-0c9ec45c-4bc4-407f-b202-198151d253fe-1607061491881@3c-app-mailcom-bs11 \
    --to=daniela-spit@gmx.it \
    --cc=dimech@gmx.com \
    --cc=help-gnu-emacs@gnu.org \
    --cc=michael_heerdegen@web.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).