Open lxsameer opened 10 years ago
If possible I am in :)
+1
Hi, here is a quick way how to do that. I've created a X bitmap image and used it as a value for stipple face attribute.
static unsigned char vline_bits[] = { 0x10, 0x00, 0x00, 0x00 };
There are some problems with pixel width of chars (you have to have same pixel width of xbm image and character or it gets messy). In my case it's 7 pixels. You can check yours with
(frame-char-width (selected-frame))
and adjust the image accordingly.
Here is some elisp for adjusting faces
(set-face-attribute 'highlight-indentation-face nil
:stipple (list 7 4 (string 16 0 0 0))
:inherit nil)
(set-face-attribute 'highlight-indentation-current-column-face nil
:stipple (list 7 4 (string 16 0 0 0))
:inherit nil
:foreground "yellow")))
and here is a preview.
looks amazing @vlcek thanks
@vlcek can you please create a patch?
+1
I would be very happy if you could specify both a mark character and a face (kind of like how whitespace-mode does it). Then you could e.g. have a faint '|' character. No worrying about pixel widths since it's a regular character.
Fill-Column-Indicator is able to draw a dashed line. Maybe something can be borrowed from there?
Awesome work, @vlcek !
However, I couldn't figure out how I could create a bitmap image in Paint, with the settings that you deliverd.
#define vline_width 8
#define vline_height 4
static unsigned char vline_bits[] = {
0x10, 0x00, 0x00, 0x00 };
Any suggestion?
indent-guide can specify indent line symbol. you can use similar unicode symbols to archive this effect.
@ReneFroger This is what I use in my .emacs which seems to work pretty well for a decent range of font widths (up to char width of 16 pixels). It sets the stipple when enabling highlight-indentation mode on a buffer and looks at the current frame parameters to work out which stipple to set. It can probably be improved to handle an even wider range of widths.
(require 'highlight-indentation)
(defun my-set-highlight-stipple ()
;; Define custom stipple for highlight-indentation
;; See https://github.com/antonj/Highlight-Indentation-for-Emacs/issues/16
(let* ((char-width (frame-char-width (selected-frame)))
(hl-stipple (if (> char-width 8)
(list char-width 4 (string 16 0 0 0 0 0 0 0))
(list char-width 4 (string 16 0 0 0)))))
(set-face-attribute 'highlight-indentation-face nil
:stipple hl-stipple
:inherit nil)
(set-face-attribute 'highlight-indentation-current-column-face nil
:stipple hl-stipple
:inherit nil
:foreground "yellow"))
)
;; Patch highlight-indentation-mode to set/update a stipple attribute
(defadvice highlight-indentation-mode (before set-highlight-indentation-stipple activate)
"Sets the stipple used by indentation highlighting"
(my-set-highlight-stipple))
(edit: included char-width directly in the stipple list).
Sorry for my belated response, thanks for your reply, I really appreciate it.
I tried your setup, with char-width 7
and char-width 8
without any result. I use Consolas as font by the way, the setting for the font is configured as (set-face-attribute 'default nil :height 110 :family "Consolas")
.
Any suggestion in order to debug this?
Thanks in advance.
@Lenbok any chance that your setup is working with Consolas?
@ReneFroger Yep, I just installed consolas (nice font!) and:
This is what I get, any ideas? @Lenbok
Hey folks, is it possible to use a unicode glyph rather than bitmap, for example ⦙
, ⫶
, ⋮
, ∣
? I haven't got used with overlays (yet).
@geraldus Probably not. But see indent-guide
mode. It also works with tabs.
@bassu you've made my day! Many thanks!
I would also like to see the ability to use a Unicode glyph as I typically run emacs in terminal mode.
@Lenbok your snippet looks promising, but when i paste it into my .emacs
it doesn't seem to have any affect.
Does this still work (Emacs version 27.0.50)
Does this still work (Emacs version 27.0.50)
It looks like the :stipple
face attribute support in Emacs really only works with X11 windowing based builds, not terminal or macOS versions (given it relies on X11 bitmap support).
It would be super nice if we could use glyphs for terminal emacs :)
By slightly modifying the above snippet one can get thin vertical guide lines:
(set-face-attribute 'highlight-indentation-face nil
:stipple (list (frame-char-width (selected-frame)) 4 (string 16 16 16 16))
:inherit nil
:foreground "peru")
Information on how :stipple
works can be found here.
Is it possible to use dot instead of face for indentation guides ? or a character like middle dot ? for example something like this: