all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Running command makes buffers read-only
@ 2025-02-05  3:18 Heime via Users list for the GNU Emacs text editor
  2025-02-05 10:14 ` Joel Reicher
  0 siblings, 1 reply; 4+ messages in thread
From: Heime via Users list for the GNU Emacs text editor @ 2025-02-05  3:18 UTC (permalink / raw)
  To: Heime via Users list for the GNU Emacs text editor

I execute "M-x svm-clock", but if I run it again I get emacs complain
that all the buffers are read-only, and thus do not get a new buffer 
with a new clock.


(defun svm-clock (klname time-zone colour)
  "Display 8 clocks with the current time in different time zones."

  (interactive
    (list
      (read-string " Clock Name: " "World Clock")

      (let ( (cseq '(("UTC" . "UTC")
                     ("New York" . "America/New_York")
                     ("London" . "Europe/London")
                     ("Tokyo" . "Asia/Tokyo")
                     ("Sydney" . "Australia/Sydney")
                     ("Berlin" . "Europe/Berlin")
                     ("Los Angeles" . "America/Los_Angeles")
                     ("Kolkata" . "Asia/Kolkata"))) )

	(let* ( (tzsel (completing-read " Time Zone: "
                         (mapcar 'car cseq) nil t)) )
          (assoc tzsel cseq)))

      (let ( (cseq '("red" "green" "blue" "orange" "purple"
                     "cyan" "magenta" "yellow")) )
        (completing-read " Colour: " cseq nil t)) ))

  ;; Make or get buffer
  (let* ( (wkl-buffer (get-buffer-create klname)) )

    ;; -----------------------------------------------------------

    (with-current-buffer wkl-buffer
      (setq buffer-read-only nil)      ; allow editing
      (erase-buffer)                   ; clear buffer

      (setq buffer-read-only t))       ; make buffer read-only

    ;; -----------------------------------------------------------

    (display-buffer wkl-buffer)            ; display buffer

    ;; start updating clocks
    (svm-clock-update klname time-zone colour)))


(defun svm-clock-update (klname time-zone colour)
  "Update the clock display for TIME-ZONES."

  ;; reference to clock buffer BUFFER
  (let* ( (wkl-buffer (get-buffer klname))
          (tz-labl (car time-zone))
          (tz-envn (cdr time-zone)) )

    (when wkl-buffer
      (with-current-buffer wkl-buffer

        (setq buffer-read-only nil)       ; allow editing
        (erase-buffer)                    ; clear the buffer

        ;; set TZ environment variable for formatting time correctly
        (setenv "TZ" tz-envn)

        (insert (propertize
          (format "  %s %s\n" tz-labl (format-time-string "%H:%M %S"))
          'face `(:foreground ,colour))))

        ;; restore default environment variable after updating clocks
        (setenv "TZ" nil)

        ;; make buffer read-only again
        (setq buffer-read-only t))

      ;; schedule next update every second
      (run-at-time "1 sec" nil
        'svm-clock-update klname time-zone colour)))





^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Running command makes buffers read-only
  2025-02-05  3:18 Running command makes buffers read-only Heime via Users list for the GNU Emacs text editor
@ 2025-02-05 10:14 ` Joel Reicher
  2025-02-05 11:58   ` Heime via Users list for the GNU Emacs text editor
  0 siblings, 1 reply; 4+ messages in thread
From: Joel Reicher @ 2025-02-05 10:14 UTC (permalink / raw)
  To: Heime via Users list for the GNU Emacs text editor; +Cc: Heime

Heime via Users list for the GNU Emacs text editor 
<help-gnu-emacs@gnu.org> writes:

> I execute "M-x svm-clock", but if I run it again I get emacs 
> complain that all the buffers are read-only, and thus do not get 
> a new buffer  with a new clock.

What's your question?

Regards,

        - Joel



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Running command makes buffers read-only
  2025-02-05 10:14 ` Joel Reicher
@ 2025-02-05 11:58   ` Heime via Users list for the GNU Emacs text editor
  2025-02-05 13:31     ` Heime via Users list for the GNU Emacs text editor
  0 siblings, 1 reply; 4+ messages in thread
From: Heime via Users list for the GNU Emacs text editor @ 2025-02-05 11:58 UTC (permalink / raw)
  To: Joel Reicher; +Cc: Heime via Users list for the GNU Emacs text editor






Sent with Proton Mail secure email.

On Wednesday, February 5th, 2025 at 10:14 PM, Joel Reicher <joel.reicher@gmail.com> wrote:

> Heime via Users list for the GNU Emacs text editor
> help-gnu-emacs@gnu.org writes:
> 
> > I execute "M-x svm-clock", but if I run it again I get emacs
> > complain that all the buffers are read-only, and thus do not get
> > a new buffer with a new clock.
> 
> 
> What's your question?
> 
> Regards, > - Joel

I cannot do "M-x svm-clock" multiple times to got multiple clocks
because the buffer read-only stops me.




^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Running command makes buffers read-only
  2025-02-05 11:58   ` Heime via Users list for the GNU Emacs text editor
@ 2025-02-05 13:31     ` Heime via Users list for the GNU Emacs text editor
  0 siblings, 0 replies; 4+ messages in thread
From: Heime via Users list for the GNU Emacs text editor @ 2025-02-05 13:31 UTC (permalink / raw)
  To: Heime; +Cc: Joel Reicher, Heime via Users list for the GNU Emacs text editor






Sent with Proton Mail secure email.

On Wednesday, February 5th, 2025 at 11:58 PM, Heime via Users list for the GNU Emacs text editor <help-gnu-emacs@gnu.org> wrote:

> 
> 
> 
> 
> 
> Sent with Proton Mail secure email.
> 
> 
> On Wednesday, February 5th, 2025 at 10:14 PM, Joel Reicher joel.reicher@gmail.com wrote:
> 
> > Heime via Users list for the GNU Emacs text editor
> > help-gnu-emacs@gnu.org writes:
> > 
> > > I execute "M-x svm-clock", but if I run it again I get emacs
> > > complain that all the buffers are read-only, and thus do not get
> > > a new buffer with a new clock.
> > 
> > What's your question?
> > 
> > Regards, > - Joel
> 
> 
> I cannot do "M-x svm-clock" multiple times to got multiple clocks
> because the buffer read-only stops me.

From what I notice, the minibuffer has became read-only after the 
first call to svm-clock.




^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2025-02-05 13:31 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-02-05  3:18 Running command makes buffers read-only Heime via Users list for the GNU Emacs text editor
2025-02-05 10:14 ` Joel Reicher
2025-02-05 11:58   ` Heime via Users list for the GNU Emacs text editor
2025-02-05 13:31     ` Heime via Users list for the GNU Emacs text editor

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.