emacs-devel
[Top][All Lists]
Advanced

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

just-the-text Emacs frame (was: Emacs as a desktop environment)


From: Ted Zlatanov
Subject: just-the-text Emacs frame (was: Emacs as a desktop environment)
Date: Sat, 28 May 2011 12:49:59 -0500
User-agent: Gnus/5.110018 (No Gnus v0.18) Emacs/24.0.50 (gnu/linux)

I just want to display some text, nothing else.  How about this (based
on your code) to show some arbitrary text in a popup (no menus,
modeline, etc., just the buffer is visible)?  I think it will DTRT
whether the frame is shown already or not.  I can use this to show the
indicators, icons, and status messages.

#+begin_src lisp
(require 'battery)
(require 'timeclock)

(defvar popup-info-frame)

(defun popup-info-string ()
  (format "%s\n%s\n%s\n%s"
          (format-time-string "%H:%M %Y-%m-%d" (current-time))
          (battery-format battery-echo-area-format (funcall
                                                    battery-status-function))
          (timeclock-status-string)
          (shell-command-to-string "nmcli -p dev")))

(defun popup-info ()
  (interactive)
  (popup-info--1 " *popup status*"))

(defun popup-info--1 (bufname)
  (with-current-buffer (get-buffer-create bufname)
    (make-local-variable 'popup-info-frame)
    (if (and (boundp 'popup-info-frame)
             popup-info-frame
             (member popup-info-frame (frame-list)))
        (select-frame popup-info-frame)
      (let ((default-frame-alist '((minibuffer . nil)
                                   (width . 20)
                                   (border-width . 0)
                                   (menu-bar-lines . 0)
                                   (tool-bar-lines . 0)
                                   (unsplittable . t)
                                   (left-fringe . 0))))
        (switch-to-buffer-other-frame bufname)
        (setq popup-info-frame (selected-frame))))
    (erase-buffer)
    (setq mode-line-format nil)
    (redraw-modeline)
    (insert (popup-info-string))))

#+end_src

Let me know what you think.  It supports any number of status buffers by
name and behaves correctly even if the frame is closed.

Thanks!
Ted




reply via email to

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