help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Removing line and column number settings from some buffers


From: daniela-spit
Subject: Re: Removing line and column number settings from some buffers
Date: Fri, 4 Dec 2020 06:58:11 +0100

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 via email to

[Prev in Thread] Current Thread [Next in Thread]