Fuco1 / indicators.el

Display the buffer relative location of line in the fringe.
43 stars 5 forks source link

Create non buffer relative indicators. #1

Closed renard closed 11 years ago

renard commented 11 years ago

This is a nice tool any very easy to use.

Is it possible to attach an indicator to line in a non relative way? For example I would like to add indicators to show where buffer has been modified. Thus is may be useful to link the indicator non relatively.

Fuco1 commented 11 years ago

You mean something like adding an indicator to "line 20" that will only show when your window is actually scrolled in a way that line 20 is visible? And it always points at line 20.

If that's what you want, that's currently not possible, but it's pretty easy to add. I can also add support for the built-in bitmaps.

renard commented 11 years ago

Yes this is it.

I can be an enhancement feature.

Fuco1 commented 11 years ago

Ok, you can now add non-relative indicators with new keyword :relative (defaults to t). For non-relative indicators you can also specify the bitmap using :bitmap. See variable fringe-bitmaps for a list of built-in bitmaps.

;; create an arrow indicator at line 20
(ind-create-indicator-at-line 20 :relative nil :bitmap 'left-arrow :managed t)

These are updated using function ind-update-absolute if you manage your own lists of indicators.

renard commented 11 years ago

YEAH That rocks!

May I gonna abuse a little, anyway specifying 'left-fringe or 'right-fringe may also be a good update.

By the way I added indicators.el to el-get package manager (see https://github.com/dimitri/el-get/pull/1073).

Fuco1 commented 11 years ago

Hm, I can do that for the non-relative indicators. With the relative indicators it's a bit more difficult since the bitmaps are constructed on-the-fly. Well, I guess simply splitting them into two lists and processing each separately would work. Will check it out.

Thanks for adding it to el-get :O I guess I should also register my other packages there (I only put stuff on melpa).

Fuco1 commented 11 years ago

Done. Use :fringe 'left-fringe or ':fringe 'right-fringe` to specify the fringe (works with both absolute and relative types)

renard commented 11 years ago

Nice!

Thanks of the quick fixes.

Fuco1 commented 11 years ago

Hah, thank you. I don't even know why I wrote this in the first play, but the fact you found this not day after I uploaded it motivated me a lot to improve it :P

But seriously, I don't even have a use for this :D

I'm gonna close this issue, if you have more ideas/suggestions/problems start new issue for each one so we have some system in it.

Thanks again.

renard commented 11 years ago

I do like something to help remind me where a file has been modified, such as highlight-changes-mode. The problem with that mode is that buffer overlays are modified and may lower the contrast ratio between 2 colors.

Having such an information in the fringe is the perfect alternative.

renard commented 11 years ago

Here is a quick and dirty example of indicators.el: https://github.com/renard/indicate-change

Enjoy.

Fuco1 commented 11 years ago

Sweet! I'll add it to readme so people will check it out. Simple and useful :P

renard commented 11 years ago

By the way I noticed that every time you create a new absolute mark, a "Marker set" message is displayed.

is it mandatory for you to set a marker?

This is a bit annoying since it pollutes the Messages buffer and erase any mini buffer messages (specially if you work with el-doc).