all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Single modeline for all buffers?
@ 2014-02-05  9:38 Göktuğ Kayaalp
  2014-02-05 16:33 ` Søren Pilgård
  2014-02-05 17:46 ` martin rudalics
  0 siblings, 2 replies; 4+ messages in thread
From: Göktuğ Kayaalp @ 2014-02-05  9:38 UTC (permalink / raw
  To: help-gnu-emacs


Hi, is it possible to have Emacs show only one modeline at the very
bottom of the screen, which shows information about the buffer in the
selected window? E.g. instead of this,

     | [#]include <stdio.h>     | (defun add (x y) (+ x y)\|
     | int main(int argc, char \| )                        |
     | ** argv, char ** envp) { | (ad[d] 5 6) ;=> 11       |
     -------------------------------------------------------
     |-:-- hello.c  Top (1, 0)  |-:**- *scratch* Top (2, 2)|
     -------------------------------------------------------
     |                                                     |
     -------------------------------------------------------

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

Cheers

--
GK

«Most people do not listen with the intent to understand; they listen
 with the intent to reply.»
                                                      — Stephen R. Covey




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

* Re: Single modeline for all buffers?
  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
  1 sibling, 0 replies; 4+ messages in thread
From: Søren Pilgård @ 2014-02-05 16:33 UTC (permalink / raw
  To: Göktuğ Kayaalp; +Cc: help-gnu-emacs

On Wed, Feb 5, 2014 at 10:38 AM, Göktuğ Kayaalp <self@gkayaalp.com> wrote:
>
> Hi, is it possible to have Emacs show only one modeline at the very
> bottom of the screen, which shows information about the buffer in the
> selected window? E.g. instead of this,
>
>      | [#]include <stdio.h>     | (defun add (x y) (+ x y)\|
>      | int main(int argc, char \| )                        |
>      | ** argv, char ** envp) { | (ad[d] 5 6) ;=> 11       |
>      -------------------------------------------------------
>      |-:-- hello.c  Top (1, 0)  |-:**- *scratch* Top (2, 2)|
>      -------------------------------------------------------
>      |                                                     |
>      -------------------------------------------------------
>
> 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|
>      -------------------------------------------------------
>      |                                                     |
>      -------------------------------------------------------
>
> Cheers
>

One problem with this is distinguishing the border between two buffers
above/below each other.  You might still want some kind of bar rendered there,
perhaps with a different content?



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

* Re: Single modeline for all buffers?
@ 2014-02-05 17:46 ` martin rudalics
  2014-02-05 18:19   ` Drew Adams
  0 siblings, 1 reply; 4+ messages in thread
From: martin rudalics @ 2014-02-05 17:46 UTC (permalink / raw
  To: self; +Cc: help-gnu-emacs

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



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

* RE: Single modeline for all buffers?
  2014-02-05 17:46 ` martin rudalics
@ 2014-02-05 18:19   ` Drew Adams
  0 siblings, 0 replies; 4+ messages in thread
From: Drew Adams @ 2014-02-05 18:19 UTC (permalink / raw
  To: martin rudalics, self; +Cc: help-gnu-emacs

My response would be: why?
A mode line is mode-specific by design.

Sounds like this might be an XY problem.
http://meta.stackoverflow.com/questions/66377/what-is-the-xy-problem

What is the real problem you are trying to solve or the
real feature you are looking for?  Can you describe it without
mentioning the mode line?



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

end of thread, other threads:[~2014-02-05 18:19 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
2014-02-05 18:19   ` Drew Adams

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.