I wanted something that highlighted a snippet of code that I wanted to keep in mind - NOT marking it, I just want it to pop out visually. As a bonus, I'd like it to get pushed to the mark ring so I can navigate back to it easily. highlight.el and similar packages are annoying though, because if the region is not active, they'll highlight the entire buffer - for what reason, I have no idea but it makes them unusable imo, as I want to be able to tag stuff with a single keystroke. So:
;; highlights line if region not active
(defun highlight-region (beg end)
(interactive "r")
(unless (use-region-p)
(setq beg (line-beginning-position))
(setq end (line-end-position)))
(push-mark beg)
(set-text-properties
beg end
'(font-lock-face (:background "yellow" :foreground "black")
highlighted t
help-echo "highlighted")))
This works great, along with some related functions I stole from somewhere. But what I'd like is for the full line, from col 1 to col 80, to be highlighted - not just the columns that contains text and none of the overflow at col 81+. I'd need something like
(setq end (point-at-col 80))
does something like this exist?
(point-at-col 80)
to return. – npostavs Oct 10 '17 at 17:04kill-ring
. If the text on the current line does not cover all 80 columns, what text do you expect to be added to thekill-ring
? – Drew Oct 10 '17 at 18:01