emacs-devel
[Top][All Lists]
Advanced

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

Re: just-the-text Emacs frame


From: Thierry Volpiatto
Subject: Re: just-the-text Emacs frame
Date: Sat, 28 May 2011 22:18:14 +0200
User-agent: Gnus/5.110018 (No Gnus v0.18) Emacs/24.0.50 (gnu/linux)

Ted Zlatanov <address@hidden> writes:

> I just want to display some text, nothing else.  How about this (based

Do you know popup.el? (you should find it on emacswiki in auto-complete).

--8<---------------cut here---------------start------------->8---
(require 'popup)

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

(popup-tip (popup-info-string))
--8<---------------cut here---------------end--------------->8---

> 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
>
>
>

-- 
A+ Thierry
Get my Gnupg key:
gpg --keyserver pgp.mit.edu --recv-keys 59F29997 




reply via email to

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