unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Placing eol glyph (buffer-display-table) before an overlay after-string.
@ 2017-08-12  6:14 Keith David Bershatsky
  2017-08-12  6:56 ` Eli Zaretskii
  2017-08-12  9:26 ` Yuri Khan
  0 siblings, 2 replies; 7+ messages in thread
From: Keith David Bershatsky @ 2017-08-12  6:14 UTC (permalink / raw)
  To: emacs-devel

My goal is to use a pilcrow to represent line endings, and this option can be set up using the appropriate buffer-display-table entry.

I have a custom minor mode that draws cross-hairs the length of the screen to track the cursor position, which requires the use of the overlay after-string property.  Emacs draws the eol glyph after the overlay after-strings are placed -- i.e., to the right of the after-string.  The result is that the eol glyph (e.g., pilcrow) is always on the far right of the after-string overlay.  I want the eol glyph to appear at the end of the line of text, and the overlay after-string should come after the eol glyph (not before).

Is it feasible to reverse the order such that the eol glyph is laid before the overlays containing the after-string property?

A hint as to the locations (in the C code) where I would start working on reversing the order would be greatly appreciated.

If there is a better way to handle this than trying to reverse the order in which things are happening, any insight would be helpful.

WORKAROUND:  I have been using a custom XPM image of a pilcrow that is the beginning of the after-string, and I change its coloration (foreground/background) as needed.  The problem with this approach is that the XPM does not look as good as a native eol glpyh, and the XPM would need to be adjusted depending upon the font and size of the font.

Thanks,

Keith David Bershatsky



^ permalink raw reply	[flat|nested] 7+ messages in thread
* Re: Placing eol glyph (buffer-display-table) before an overlay after-string.
@ 2017-08-12 19:03 Keith David Bershatsky
  0 siblings, 0 replies; 7+ messages in thread
From: Keith David Bershatsky @ 2017-08-12 19:03 UTC (permalink / raw)
  To: Eli Zaretskii, Yuri Khan; +Cc: emacs-devel

[-- Attachment #1: Type: text/plain, Size: 4974 bytes --]

Thank you, Eli, for letting me know the exact locations responsible for the behavior at issue, and also for suggesting the use of a real pilcrow in the overlay after-string as a possible workaround.

I have attached a couple of screen-shots and links to the same uploaded images, which were requested by Yuri.  One screen-shot is *without* the pilcrow buffer-display-table entry and *with* the after-string (containing an XPM pilcrow).  The other screen-shot is *with* a pilcrow buffer-display-table and *with* the after-string (containing the XPM pilcrow) -- all of the pilcrows to the immediate right of the vertical line are the pilcrow buffer-display-table entries that were laid during redisplay subsequent to the after-string.

The cross-hairs are designed to be compatible when word-wrap is non-nil and truncate-lines is nil.  It involves time costly custom vertical-motion calculations on each screen line.  I have set up a list of functions that trigger drawing cross-hairs, and also a list of functions that trigger removing cross-hairs and temporarily inhibit new cross-hairs from being drawn.  The horizontal line of the cross-bar and eol pilcrows draw each command loop for things like self-insert-command, whereas the vertical line of the cross-bar is on an idle-timer.  There are a few functions that trigger unconditional drawing of horizontal/vertical lines for a complete cross-hairs, such as switching to a window where that minor-mode is active.  I use a more recent implementation of Emacs Bug feature #22404 to o
 btain definitive window-start/end values and the cross-hairs (with corresponding calculations) regarding same are limited to the bounds of the visible window.

The idea about using a regular pilcrow as part of the overlay after-string instead of an XPM would "probably" [untested] work if I use the new multiple fake cursors feature (Emacs Bug feature #22873) to achieve a vbar cursor through the pilcrow whenever the cursor vertically lines up with an eol pilcrow.  Prior to the invention of #22873, I achieved the vertical bar through the eol pilcrow with an XPM that can change colors at different areas of the pilcrow depending upon the situation -- e.g., odd/even numbered columns, fill-column and beyond, last point at right window edge, and wrapped lines subsequent to the first wrapped screen line.  The hbar fake cursor can also be used with a real pilcrow in lieu of the horizontal line that I have been creating as part of the XPM pilcrow.

To save time with certain rapid-fire commands like scrolling and moving the real cursor around, I erase the cross-hairs overlays and inhibit vertical-motion calculation.  The pilcrows disappear as a result.  The visual affect of the pilcrows disappearing while the cross-hairs are temporarily inhibited from being drawn is something that I have never been able to get accustomed to seeing.  I previously experimented with temporarily removing the XPM pilcrows and temporarily enabling the buffer-display-table pilcrows for rapid-fire functions (e.g., scrolling and cursor movement), but there was a time cost and I seem to remember another hitch/glitch in involved in timing and also the visual effect when subsequently removing the buffer-display-table entry and re-enabling the XPM overlays.

Keeping the eol pilcrows visible when the cross-hairs are disabled is my preferred behavior (if possible), and that is what lead me to launching this particular thread.

Here are the two flavors of XPM pilcrows that I presently use for the custom cross-hairs minor-mode:

(defvar xpm--pilcrow
"/* XPM */
static char * pilcrow_special_xpm[] = {
\"11 20 10 1\",
\"+ s col1\",
\". s col2\",
\"% s col3\",
\"@ s col4\",
\"& s col5\",
\"# s col6\",
\"^ s col7\",
\"! s col8\",
\"$ s col9\",
\"* s col10\",
\"%.........@\",
\"%.........@\",
\"%.........@\",
\"%.........@\",
\"%.........@\",
\"%..!!!!!!.@\",
\"%.!!!!.!..@\",
\"%.!!!!.!..@\",
\"%.!!!!.!..@\",
\"%..!!!.!..@\",
\"%....!.!..@\",
\"%....!.!..@\",
\"%....!.!..@\",
\"%....!.!..@\",
\"%....!.!..@\",
\"%....!.!..@\",
\"%.........@\",
\"%.........@\",
\"&+++++++++#\",
\"%.........@\"};")

(defvar pilcrow
"/* XPM */
static char * pilcrow_regular_xpm[] = {
\"11 20 10 1\",
\"+ s col1\",
\". s col2\",
\"% s col3\",
\"@ s col4\",
\"& s col5\",
\"# s col6\",
\"^ s col7\",
\"! s col8\",
\"$ s col9\",
\"* s col10\",
\"%.........@\",
\"%.........@\",
\"%.........@\",
\"%.........@\",
\"%.........@\",
\"%..++++++.@\",
\"%.++++.+..@\",
\"%.++++.+..@\",
\"%.++++.+..@\",
\"%..+++.+..@\",
\"%....+.+..@\",
\"%....+.+..@\",
\"%....+.+..@\",
\"%....+.+..@\",
\"%....+.+..@\",
\"%....+.+..@\",
\"%.........@\",
\"%.........@\",
\"%.........@\",
\"%.........@\"};")

I am including links to the uploaded pictures just in case the mail list cannot handle storage of files that exceed a certain limit.

Links to the same images that are attached:

https://lawlist.com/images/xpm_only.png

https://lawlist.com/images/with_buffer_display_table.png


[-- Attachment #2: with_buffer_display_table.png --]
[-- Type: application/png, Size: 176100 bytes --]

[-- Attachment #3: xpm_only.png --]
[-- Type: application/png, Size: 172993 bytes --]

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

end of thread, other threads:[~2017-08-12 19:03 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-08-12  6:14 Placing eol glyph (buffer-display-table) before an overlay after-string Keith David Bershatsky
2017-08-12  6:56 ` Eli Zaretskii
2017-08-12  9:26 ` Yuri Khan
2017-08-12  9:52   ` Eli Zaretskii
2017-08-12 10:18     ` Yuri Khan
2017-08-12 10:32       ` Eli Zaretskii
  -- strict thread matches above, loose matches on Subject: below --
2017-08-12 19:03 Keith David Bershatsky

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).