< [new:AlpAker:2011-04-05 00:44 UTC]]
< FillColumnIndicator can do the sort of shading that Lennart asks about above. (It requires at least v22, though.)
> FillColumnIndicator can display that sort of one-pixel line.
From the homepage:
Note that the version posted is broken in CVS GNU Emacs. The MARGIN-CHANGE function doesn’t correctly handle being run in the background by jit-lock (since it refers to the extent of the current window). The symptom is an interruptible hang (^G) with Emacs burning 100% of CPU. Replace the function’s definition with the following:
(defun margin-change (beg end) "Refresh margins in region BEG to END." (save-excursion (dolist (o (overlays-in beg end)) (when (margin-overlay-p o) (delete-overlay o)))
(goto-char beg) (while (> end (point)) (let ((start-of-line (line-beginning-position)) (end-of-line (line-end-position))) (make-margin-overlay start-of-line end-of-line) (goto-char (+ end-of-line 1))))))
Also consider vvb-mode (Visible Vertical Bar): Geocities:gchen275xemacs
I am looking for a minor mode for emacs which shows the area right of the fill column in another color, regardless if any characters have been typed into that area or not. Think of a window which is split into two parts which differ by the background color: left a white part and right a light gray part which is beyond the fill column. Anyone? I’ve not been successfuly googling about that.
Both (thin line and highlighting) is possible with overlays. Here is a, horrible slow, proof of concept:
(defvar highlight-fill-column-string "\u2502") (defvar highlight-fill-column-face 'highlight) (defun highlight-fill-column (&rest _) (remove-overlays nil nil 'highlight-fill-column t) (save-excursion (goto-char (point-min)) (while (not (eobp)) (let ((rest-width (- fill-column (save-excursion (end-of-line) (current-column))))) (let* ((ov (make-overlay (line-end-position) (1+ (line-end-position)) nil t)) (ov2 (copy-overlay ov)) (string (concat (when (> rest-width 0) (propertize (string 32) 'display `(space-width ,rest-width) 'cursor t)) (when (>= rest-width 0) (propertize highlight-fill-column-string 'cursor (= rest-width 0)))))) (overlay-put ov 'before-string string) (overlay-put ov2 'face highlight-fill-column-face) (overlay-put ov 'priority 1) (overlay-put ov2 'priority 2) (overlay-put ov 'highlight-fill-column t) (overlay-put ov2 'highlight-fill-column t))) (next-line)))) (define-minor-mode highlight-fill-column-mode nil nil nil nil nil (if highlight-fill-column-mode (progn (add-hook 'after-change-functions 'highlight-fill-column nil t) (highlight-fill-column)) (remove-overlays nil nil 'highlight-fill-column t) (remove-hook 'after-change-functions 'highlight-fill-column t)))
I (and, it seems, many others) would like to be able to specify a right edge column and then have a single pixel wide line drawn at that column. Such a feature has existed in many much simpler editors going back more than 10 years. I have a colleague who uses CodeWright? and that vertical bar is the only feature I covet. – JohnYates?
You can do this using font-lock mode. Add a pattern that matches column N and then assign a face that has a pixmap with a single pixel vertical line. – AmitPatel
That sort of thing only works for lines which have text at that column, though I’m not sure why anything else is necessary.
What I am using is highlight-beyond-fill-column. It only works for a specific fill-column though.
Lisp:column-marker.el does exactly what you’re asking for.
Can someone please demonstrate how? As stated above, column-marker.el only marks the column if there is text there, and it highlights the whole column rather than displaying a single, one-pixel-wide line, so I’m pretty sure that column-marker’s default configuration is not what JohnYates? was asking for.
What do you need to do to make it look more like the Visual Studio guidelines feature – for instance, http://blogs.msdn.com/b/saraford/archive/2004/11/15/257953.aspx ? I didn’t get anywhere customizing the column-marker-1 face.
FillColumnIndicator can display that sort of one-pixel line.