From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Ted Zlatanov Newsgroups: gmane.emacs.devel Subject: Re: just-the-text Emacs frame Date: Wed, 01 Jun 2011 13:01:09 -0500 Organization: =?utf-8?B?0KLQtdC+0LTQvtGAINCX0LvQsNGC0LDQvdC+0LI=?= @ Cienfuegos Message-ID: <87vcwpsa6y.fsf@lifelogs.com> References: <87aaebbndz.fsf@lifelogs.com> <4DDDA5A7.6040109@siege-engine.com> <87boyp5vyi.fsf@lifelogs.com> <87mxi8xq6y.fsf@lifelogs.com> <874o4ebtq0.fsf_-_@lifelogs.com> Reply-To: emacs-devel@gnu.org NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: dough.gmane.org 1306978617 30830 80.91.229.12 (2 Jun 2011 01:36:57 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Thu, 2 Jun 2011 01:36:57 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Jun 02 03:36:53 2011 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([140.186.70.17]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1QRwqC-0005ZE-Tl for ged-emacs-devel@m.gmane.org; Thu, 02 Jun 2011 03:36:53 +0200 Original-Received: from localhost ([::1]:39029 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QRwqB-00056L-Ep for ged-emacs-devel@m.gmane.org; Wed, 01 Jun 2011 21:36:51 -0400 Original-Received: from eggs.gnu.org ([140.186.70.92]:40617) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QRvfe-0002fl-0w for emacs-devel@gnu.org; Wed, 01 Jun 2011 20:21:55 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QRvfb-0002hj-Vb for emacs-devel@gnu.org; Wed, 01 Jun 2011 20:21:53 -0400 Original-Received: from lo.gmane.org ([80.91.229.12]:45434) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QRpjW-00077F-Mz for emacs-devel@gnu.org; Wed, 01 Jun 2011 14:01:31 -0400 Original-Received: from list by lo.gmane.org with local (Exim 4.69) (envelope-from ) id 1QRpjR-0007bf-AQ for emacs-devel@gnu.org; Wed, 01 Jun 2011 20:01:25 +0200 Original-Received: from 38.98.147.130 ([38.98.147.130]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 01 Jun 2011 20:01:25 +0200 Original-Received: from tzz by 38.98.147.130 with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 01 Jun 2011 20:01:25 +0200 X-Injected-Via-Gmane: http://gmane.org/ Mail-Followup-To: emacs-devel@gnu.org Original-Lines: 153 Original-X-Complaints-To: usenet@dough.gmane.org X-Gmane-NNTP-Posting-Host: 38.98.147.130 X-Face: bd.DQ~'29fIs`T_%O%C\g%6jW)yi[zuz6; d4V0`@y-~$#3P_Ng{@m+e4o<4P'#(_GJQ%TT= D}[Ep*b!\e,fBZ'j_+#"Ps?s2!4H2-Y"sx" Mail-Copies-To: never User-Agent: Gnus/5.110018 (No Gnus v0.18) Emacs/24.0.50 (gnu/linux) Cancel-Lock: sha1:zDGEz6cYhxJqOC6j1RVMVjGCqzk= X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 80.91.229.12 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:140043 Archived-At: --=-=-= Content-Type: text/plain On Sat, 28 May 2011 12:49:59 -0500 Ted Zlatanov wrote: TZ> I just want to display some text, nothing else. How about this (based TZ> on your code) to show some arbitrary text in a popup (no menus, TZ> modeline, etc., just the buffer is visible)? I think it will DTRT TZ> whether the frame is shown already or not. I can use this to show the TZ> indicators, icons, and status messages. Attached is emacs-panel.el, which does the above. It support arbitrary frames, each one showing a specific buffer and refreshing its content on a timer with a function associated with that buffer. There's an example in the commentary that shows how it's used. It works for me. Let me know what you think; next I will start adding pieces to this framework to implement each of the tasks I listed earlier. Thanks Ted --=-=-= Content-Type: application/emacs-lisp Content-Disposition: attachment; filename=emacs-panel.el Content-Transfer-Encoding: quoted-printable ;;; emacs-panel.el --- gnome-panel-like functionality for Emacs ;; Copyright (C) 2011 Teodor Zlatanov ;; Author: Teodor Zlatanov ;; This program is free software; you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by ;; the Free Software Foundation, either version 3 of the License, or ;; (at your option) any later version. ;; This program is distributed in the hope that it will be useful, ;; but WITHOUT ANY WARRANTY; without even the implied warranty of ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;; GNU General Public License for more details. ;; You should have received a copy of the GNU General Public License ;; along with this program. If not, see . ;;; Commentary: ;; example: ;; (require 'battery) ;; (require 'timeclock) ;; (emacs-panel-popup-add ;; "status" :function ;; (lambda () ;; (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-func= tion)) ;; (timeclock-status-string) ;; (shell-command-to-string "nmcli -p dev")))) ;(emacs-panel-popup-remove "status") ;;; Code: (eval-when-compile (require 'cl)) (require 'timer) (defgroup emacs-panel nil "The Emacs panel." :version "24.1") (defvar emacs-panel-popup-frame) (defvar emacs-panel-popup-timer (run-at-time t 1 'emacs-panel-popup-runqueue)) (defcustom emacs-panel-popups nil "Alist of defined popup buffers format: (NAME :function F :frame-params P ...) The keys besides :function (called on a refresh) and :frame-params (used for new frames) are: ... TODO ..." :group 'emacs-panel) (defcustom emacs-panel-popup-interval 5 "How often to refresh the popups, in seconds." :group 'emacs-panel :type 'integer) (defvar emacs-panel-current-cycle 0) (defun emacs-panel-popup-add (name &rest params) (unless (emacs-panel-popup-entry name) (add-to-list 'emacs-panel-popups `(,name ,@params)))) (defun emacs-panel-popup-remove (name) (setq emacs-panel-popups (remove* name emacs-panel-popups :key 'car :test 'equal))) (defun emacs-panel-popup-entry (name) (cdr-safe (assoc name emacs-panel-popups))) (defun emacs-panel-popup-runqueue () (interactive) (incf emacs-panel-current-cycle) (when (zerop (mod emacs-panel-current-cycle emacs-panel-popup-interval)) (loop for p in emacs-panel-popups do (emacs-panel-popup (car-safe p))))) (defun emacs-panel-popup (name) (let* ((old-frame (selected-frame)) (entry (emacs-panel-popup-entry name)) (func (plist-get entry :function)) (frame-params (plist-get entry :frame-params)) (bufname (concat " *" name "*"))) (save-excursion (with-current-buffer (get-buffer-create bufname) (make-local-variable 'emacs-panel-popup-frame) (if (and (boundp 'emacs-panel-popup-frame) emacs-panel-popup-frame (member emacs-panel-popup-frame (frame-list))) (select-frame emacs-panel-popup-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) ,@frame-params))) (switch-to-buffer-other-frame bufname) (setq emacs-panel-popup-frame (selected-frame)))) (when func (setq mode-line-format nil) (redraw-modeline) ;; TODO: optimize and improve (erase-buffer) (insert (funcall func))))) (select-frame old-frame))) (defun emacs-panel-unload-function () (cancel-timer emacs-panel-popup-timer)) (provide 'emacs-panel) ;;; emacs-panel.el ends here --=-=-=--