[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#45068: [PATCH] Modus themes 1.2.0
From: |
Protesilaos Stavrou |
Subject: |
bug#45068: [PATCH] Modus themes 1.2.0 |
Date: |
Sat, 06 Mar 2021 20:43:48 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) |
On 2021-03-06, 18:25 +0000, Gregory Heytings <gregory@heytings.org> wrote:
>>
>> It works. Thank you!
>>
>
> You are welcome :-) Actually the previous version had a bug with
> tab-indented lines. It is fixed now:
>
> (defun undercaret (&optional arg)
> (interactive "p")
> (let* ((begin (if (region-active-p) (region-beginning)
> (line-beginning-position)))
> (end (if (region-active-p) (region-end) (line-end-position)))
> (lines (- (line-number-at-pos end) (line-number-at-pos begin) -1))
> (comment (and (/= arg 1) (= lines 1)))
> (final-forward-line -1))
> (goto-char begin)
> (dotimes (i lines)
> (let* ((line-begin (if (zerop i) begin (line-beginning-position)))
> (line-end (if (= (1+ i) lines) end (line-end-position)))
> (begin-column (progn (goto-char line-begin) (current-column)))
> (end-column (progn (goto-char line-end) (current-column)))
> (prefix-begin (line-beginning-position))
> (prefix-end (progn (beginning-of-line-text) (point)))
> (prefix-end-column (progn (goto-char prefix-end)
> (current-column)))
> (delta (if (< begin-column prefix-end-column) (-
> prefix-end-column begin-column) 0))
> (prefix-string (buffer-substring-no-properties prefix-begin
> prefix-end))
> (prefix (if (string-match-p "\\` *\\'" prefix-string) ""
> prefix-string))
> (whitespace (make-string (- (+ begin-column delta) (string-width
> prefix)) ?\ ))
> (do-under (< delta (- line-end line-begin)))
> (under (if do-under (make-string (- end-column begin-column
> delta) ?^) ""))
> (under-string (concat prefix whitespace under "\n")))
> (forward-line 1)
> (if do-under (insert under-string) (setq final-forward-line -2))
> (setq end (+ end (length under-string)))
> (when comment (insert prefix whitespace "\n"))))
> (forward-line final-forward-line)
> (goto-char (line-end-position))))
I admit not to have tested it thoroughly (not yet, anyway). Though I do
plan to use your function. Thanks!
I will eventually include it in my public dotfiles' repo. Is there a
link I could provide as a reference to your contribution? Or just cite
the message in this thread?[1]
[1]: <https://debbugs.gnu.org/cgi/bugreport.cgi?bug=45068#250>.
> (BTW, sorry for the off-topic noise on your thread on modus-themes, but
> it was you who asked for a solution ;-))
Yes, I guess this is not the right place to discuss this feature...
Though the bug has been closed successfully.
I had asked because I was under the impression that Gnus or some other
library was implementing it.
--
Protesilaos Stavrou
protesilaos.com
- bug#45068: [PATCH] 28.0.50; Update Modus themes 1.0.2 (backward-incompatible), (continued)
- bug#45068: [PATCH] 28.0.50; Update Modus themes 1.0.2 (backward-incompatible), Protesilaos Stavrou, 2021/03/05
- bug#45068: [PATCH] Modus themes 1.2.0, Basil L. Contovounesios, 2021/03/05
- bug#45068: [PATCH] Modus themes 1.2.0, Protesilaos Stavrou, 2021/03/05
- bug#45068: [PATCH] Modus themes 1.2.0, Basil L. Contovounesios, 2021/03/05
- bug#45068: [PATCH] Modus themes 1.2.0, Protesilaos Stavrou, 2021/03/06
- bug#45068: [PATCH] Modus themes 1.2.0, Basil L. Contovounesios, 2021/03/06
- bug#45068: [PATCH] Modus themes 1.2.0, Gregory Heytings, 2021/03/05
- bug#45068: [PATCH] Modus themes 1.2.0, Gregory Heytings, 2021/03/06
- bug#45068: [PATCH] Modus themes 1.2.0, Protesilaos Stavrou, 2021/03/06
- bug#45068: [PATCH] Modus themes 1.2.0, Gregory Heytings, 2021/03/06
- bug#45068: [PATCH] Modus themes 1.2.0,
Protesilaos Stavrou <=
- bug#45068: [PATCH] 28.0.50; Update Modus themes 1.0.2 (backward-incompatible), Basil L. Contovounesios, 2021/03/04
bug#45068: [PATCH] 28.0.50; Update Modus themes 1.0.2 (backward-incompatible), Protesilaos Stavrou, 2021/03/01
bug#45068: [PATCH] 28.0.50; Update Modus themes 1.0.2 (backward-incompatible), Protesilaos Stavrou, 2021/03/01
bug#45068: [PATCH] 28.0.50; Update Modus themes 1.0.2 (backward-incompatible), Protesilaos Stavrou, 2021/03/01