This may have been intended for plain text emails, which get quoted in replies by adding a character (usually >) and often a space at the beginning of each line. 70 columns allow 8 levels of quoting on an 80-column terminal (8 > plus a space plus the rightmost column is reserved for a continuation character to indicate that the line overflows). Back in ...
The following three lines of code in this specific order will immediately visibly update the fci-rule-color -- in this example, I am using the color "red".
(setq fci-rule-color "red")
I don't think there's anything wrong with what you're doing. If it works I don't see any obvious pitfalls.
That said, it's not the usual way to apply mode-specific settings. This is usually done with a mode-hook. For example, I have the following in my init:
(defun my-org-src-mode-hook ()
(setq fill-column 65)
Here's the complete end-to-end solution I ended up with based on lawlist's answer.
(defun my:color-is-closer-to-white-p (color)
"Returns t if COLOR is closer to white than black."
(< (color-distance color "white") (color-distance color "black")))
(defun my:get-subtle-color-from-background (percent-difference)
"Gets a shade PERCENT-DIFFERENCE ...
You didn't mention which major mode this happens in, but I can see the problem using c-mode. Here is an (abridged) backtrace which you can get after setting debug-on-error:
Debugger entered--Lisp error: (args-out-of-range #<buffer xx> 66 66)...
buffer-substring(#<marker at 66 in xx> #<marker at 66 in xx>)
Aha, I have the solution! Put this somewhere in your .emacs/.emacs.d/init.el file:
(define-advice current-fill-column (:filter-return (rtn) protrusion)
"Advice to allow hanging punctuation when filling text."
;; Get the character after the proposed cutoff point
(let ((end-char (char-after (1+ rtn))))
(if (and end-char
;; Check if ...
Filling is a general facility which can depend on more than just the fill-column variable, however the first thing to test is simply that you're checking the fill-column value for the correct buffer -- it can have a different value in each buffer; so if you typed C-hv from some other buffer, you might see the wrong value.
C-hf fill-paragraph tells us that ...
I'd do this with a combination of re-search-forward and replace-match on subgroups (in this case the spaces just before and after *. You can simplify the regular expression if you don't want match the timestamps.
(defun add-dashes-to-line ()
(when (re-search-forward (rx "-" space
Based on @Drew's answer, I ended up doing this:
;; function to get window width
(defun my-get-window-width ()
"Get width of current window in."
(/ (window-body-width nil t)
;; function to set the fill column
(defun my-auto-set-fill-column ()
"Set fill-column to window width."
(let ((inhibit-message 1))
I had comment-auto-fill-only-comments set to t. Since Magit commit buffer supports comments, it won't auto-fill.
(defun me/git-commit-set-fill-column ()
(setq-local comment-auto-fill-only-comments nil)
(setq fill-column 72))
(advice-add 'git-commit-turn-on-auto-fill :before #'me/git-...
This is a known issue with org-mode and fci-mode. See here and here for a discussion and some suggested solutions. Personally, I found the cure to be worse than the symptom and it didn't quite fit with what I wanted.
I have instead found an alternative which works with org-mode and still provides me with the sort of information I was after with fci-mode. I ...
Here's a workaround that displays fci when its needed.
Note that while it takes horizontal scroll into account, I couldn't find a hook to run when horizontal scrolling changes.
if fci-rule-column isn't set it uses the value for fill-column.
(defvar i42/fci-mode-suppressed nil)
Here's the answer to a post where I struggled with a similar problem concering visual-line-mode.
@YoungFrog describes how visual-line-mode works pretty well in a comment. Long story short, visual-line-mode involves only 'soft' new lines, i.e. it does not actually edit the formatting of your text at all, it only makes it look like your text is a certain line ...