all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: martin rudalics <rudalics@gmx.at>
To: self@gkayaalp.com
Cc: help-gnu-emacs@gnu.org
Subject: Re: Single modeline for all buffers?
Date: Wed, 05 Feb 2014 18:46:48 +0100	[thread overview]
Message-ID: <52F27908.1030809@gmx.at> (raw)

 > Can I have sth. like the following?
 >
 >      | [#]include <stdio.h>     | (defun add (x y) (+ x y)\|
 >      | int main(int argc, char \| )                        |
 >      | ** argv, char ** envp) { | (add 5 6) ;=> 11         |
 >      -------------------------------------------------------
 >      |-:-- hello.c  Top (1, 0)   (C/l Arev AC hl-p hl-s Abb|
 >      -------------------------------------------------------
 >      |                                                     |
 >      -------------------------------------------------------

Not really.  This would require a major redesign of the involved
components.  If you have Emacs 24.4 you can try (better with Emacs -Q)
the proof of concept below (for fun only).

If you are really interested, you'd have to fill in two things:

(1) A mechanism that would allow this to work with multiple frames (that
     is, things like mode-line-buffer and mode-line-window would have to
     become frame parameters).  This is fairly easy.

(2) A mechanism to implement keybindings in the mode-line buffer.  This
     should be easy too but is likely tedious.  You would mostly have to
     replace occurrences of

       (with-selected-window (posn-window (event-start event))

     with something like

       (with-selected-window mode-line-really-selected-window

     where mode-line-really-selected-window would refer to the window the
     mode-line is currently talking about.

martin


(defvar mode-line-buffer (get-buffer-create "mode-line"))

(defvar mode-line-window (display-buffer-in-side-window mode-line-buffer nil))

(defvar original-mode-line nil)
(make-variable-buffer-local 'original-mode-line)

(with-current-buffer mode-line-buffer
   (font-lock-mode -1)
   (setq mode-line-format nil))

(defun mode-line-buffer-list ()
   (walk-window-tree
    (lambda (window)
      (with-current-buffer (window-buffer window)
        (when mode-line-format
	 (setq original-mode-line-format mode-line-format)
	 (setq mode-line-format nil))))))

(defun mode-line-post-command ()
   (let ((format original-mode-line-format)
	(buffer (current-buffer))
	(window (selected-window)))
     (with-selected-window mode-line-window
       (erase-buffer)
       (insert (format-mode-line format 'mode-line window buffer))
       (let ((window-min-height 1)
	    (window-resize-pixelwise t))
	(setq window-size-fixed nil)
	(fit-window-to-buffer)
	(set-window-start nil (point-min))
	(setq window-size-fixed t)))))

(with-selected-window mode-line-window
   (buffer-face-set 'mode-line)
   (setq default-frame-alist '((right-divider-width . 4) (bottom-divider-width . 4)))
   (set-window-margins nil 0 0)
   (set-window-fringes nil 0 0)
   (set-window-scroll-bars nil 0)
   (setq cursor-type nil)
   (set-window-parameter nil 'no-other-window t)
   (set-window-dedicated-p nil t))

(add-hook 'post-command-hook 'mode-line-post-command)
(add-hook 'buffer-list-update-hook 'mode-line-buffer-list)



         reply	other threads:[~2014-02-05 17:46 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-05  9:38 Single modeline for all buffers? Göktuğ Kayaalp
2014-02-05 16:33 ` Søren Pilgård
2014-02-05 17:46 ` martin rudalics [this message]
2014-02-05 18:19   ` Drew Adams

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=52F27908.1030809@gmx.at \
    --to=rudalics@gmx.at \
    --cc=help-gnu-emacs@gnu.org \
    --cc=self@gkayaalp.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.