Closed qwiglydee closed 9 years ago
The problem is that it is hard to highlight lines without content. It could probably be done by using the overlays and the http://www.gnu.org/software/emacs/manual/html_node/elisp/Display-Property.html but I'm not really sure how :)
The screenshot is probably showing a buffer with spaces on empty lines...
I created this little hack, it adds whitespace equal to the whitespace of the previous section for all blank lines after every save.
(defun add-whitespace (&optional start end)
(interactive (progn
(barf-if-buffer-read-only)
(if (use-region-p)
(list (region-beginning) (region-end))
(list nil nil))))
(save-match-data
(save-excursion
(let ((end-marker (copy-marker (or end (point-max))))
(start (or start (point-min))))
(goto-char start)
(while (and (re-search-forward "^$" end-marker t) (not (>= (point) end-marker)))
(forward-line -1)
(let ((line-start (point))
(line-end (progn (back-to-indentation) (point))))
(forward-line 1)
(insert
(make-string
(- line-end line-start)
32)))
(forward-line 1)))))
nil)
(add-hook 'before-save-hook 'delete-trailing-whitespace)
(add-hook 'after-save-hook 'add-whitespace)
Also I feel like this issue should be kept open because it is still an issue that is affecting people
In GNU Emacs 24.3.1 (x86_64-pc-linux-gnu, GTK+ Version 3.8.2) (ubuntu built) The following code misses highlights in lines before "def"s:
The lines are just empty On screenshot in README.org I see such lines highlighted.
Where is the problem?