5
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 ...
answered Oct 12 '17 at 22:17
Gilles 'SO- stop being evil'
15.5k44 gold badges4040 silver badges7878 bronze badges
4
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")
(fci-make-overlay-strings)
(fci-update-all-windows t)
3
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)
(auto-fill-mode t))
(add-hook 'org-src-...
3
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 ...
2
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>)
yas--field-text-for-display([...
2
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 ...
2
temp-buffer-show-hook should help. That's where help-mode-finish is called, for instance. It is used in with-help-window and with-temp-buffer-window, which are used to display Help windows.
1
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 ()
(interactive)
(save-excursion
(beginning-of-line)
(when (re-search-forward (rx "-" space
...
1
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)
(window-font-width)))
;; function to set the fill column
(defun my-auto-set-fill-column ()
"Set fill-column to window width."
(let ((inhibit-message 1))
(set-fill-...
1
I had comment-auto-fill-only-comments set to t. Since Magit commit buffer supports comments, it won't auto-fill.
(use-package git-commit
:ensure nil
:preface
(defun me/git-commit-set-fill-column ()
(setq-local comment-auto-fill-only-comments nil)
(setq fill-column 72))
:config
(advice-add 'git-commit-turn-on-auto-fill :before #'me/git-...
1
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 ...
1
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)
(make-variable-buffer-local 'i42/fci-mode-suppressed)
(defun fci-width-...
1
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 ...
Only top voted, non community-wiki answers of a minimum length are eligible
Related Tags
fill-column × 15org-mode × 2
auto-fill-mode × 2
init-file × 1
magit × 1
auctex × 1
python × 1
git × 1
yasnippet × 1
colors × 1
highlighting × 1
display × 1
help × 1
fill-paragraph × 1
newlines × 1
line-break × 1
accessibility × 1