Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FR: Have some indicators (e.g. location) #8

Open
pank opened this issue Jan 7, 2016 · 6 comments
Open

FR: Have some indicators (e.g. location) #8

pank opened this issue Jan 7, 2016 · 6 comments

Comments

@pank
Copy link

pank commented Jan 7, 2016

Hi,

It would be nice to be able to have some indicators somewhere on the screen.
In particular, I'm interseted in having an indicator of my place in the file (e.g. the nyan cat).

Perhaps the easiest way would be to use a stripped down modeline that defaults to the being empty and with the same color as the buffers' background color.

Do you think something like that is possible? I don't knowe much about display related issues with Emacs, but if it's possible it might be a fun weekend project (for me).

Thanks,
Rasmus

_

@pank
Copy link
Author

pank commented Jan 9, 2016

I just realized this what I'm asking about is eldoc support.

A quick function to give a progress bar is:

  (defun rasmus/eldoc-progress ()
    "Display progress in buffer"
    (let* ((width 20)
           (num (/ (* (/ (* 100 (/ (+ (window-start) (window-end nil t)) 2))
                         (point-max))
                      width)
                   100)))
      (concat "|"
              (make-string num ?░)
              (make-string (- width num) ? )
              "|")))

Then (set (make-local-variable 'eldoc-documentation-function) 'rasmus/eldoc-progress)

Do you think it's within the scope of darkroom to add eldoc support? E.g. the eldoc message could be a list of user supplied functions.

@joaotavora
Copy link
Owner

If I understand correctly, you want something like a more sober version of the nyan-cat progress indicator, which, by the way is inspired by

http://www.emacswiki.org/emacs/sml-modeline.el

In that case, why not reuse that library and adjust it so that it behaves correctly when added as the sole element of mode-line-format? In that case, it would simply be a matter of

(add-hook 'darkroom-mode-hook 'sober-progress-mode)

where sober-progress-mode would tweak the mode-line-format variable with your choosing. When I say "simply a matter", I may be overlooking a bug in darkroom's hook usage, but we can handle that later....

So I would start by writing sober-progress-mode, and I wouldn't use eldoc for that, I think that's abusing eldoc's mechanisms. I would read rather read mode-line-format's documentation and see howsml-modeline.el` did it.

As to "bundling" it with darkroom, it's a little out of scope, but if it's <100 lines, I don't mind.

@pank
Copy link
Author

pank commented Jan 11, 2016

Hi João,

Sure, but sml is boring. I like the nyan-cat.

What you talk about it more in line with what I first outlined.

As I see it, it boils down to providing a sanitized mode-line which (0) uses darkroom-mode-line-format (the mode-line is automatically hidden when this is nil), and (1) adopts some 'theming' from the default face to make it not stand out.

Rasmus

@joaotavora
Copy link
Owner

Hi Rasmus,

Hi don't know if I follow, but perhaps a code example can get us started:

(defun joaot/turn-on-nyan-maybe ()
  "My personal darkroom-mode addition, just a nyan"
  (when darkroom-mode
    (setq-local nyan-bar-length (+ (window-width)
                                   (or (car (window-margins)) 0)
                                   (or (cdr (window-margins)) 0)))
    (setq-local mode-line-format '(:eval (list (nyan-create))))))

;; add it to `darkroom-mode-hook'. Beware this won't work with `darkroom-tentative-mode`.
(add-hook 'darkroom-mode-hook
          'joaot/turn-on-nyan-maybe)

@darcamo
Copy link

darcamo commented Oct 30, 2020

I also would like some indication of progress, but I progressbar might be considered distracting for some people. Something more discrete like current line | progress% could be nice to have by default.

But I also would like an indication if the buffer is modified or not. The usual * in the modline. It helps when I'm undoing something.

These are the only useful information I need with darkroom-mode activated.

@joaotavora
Copy link
Owner

joaotavora commented Oct 30, 2020 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants