From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Protesilaos Stavrou Newsgroups: gmane.emacs.bugs Subject: bug#45068: [PATCH] Modus themes 1.2.0 Date: Sat, 06 Mar 2021 20:43:48 +0200 Message-ID: <878s70f7h7.fsf@protesilaos.com> References: <87im9fgm27.fsf@protesilaos.com> <874khwn1qf.fsf@protesilaos.com> <603b8171.1c69fb81.aa664.7f40@mx.google.com> <87mtvoxsvs.fsf@protesilaos.com> <603b9b9d.1c69fb81.f37aa.cb7c@mx.google.com> <83eegz7xcx.fsf@gnu.org> <87o8g3exjv.fsf@protesilaos.com> <603d053a.1c69fb81.f4cb8.fb14@mx.google.com> <87h7luga3p.fsf@protesilaos.com> <87o8g2bg89.fsf@tcd.ie> <87r1kyrtrl.fsf@protesilaos.com> <878s75x2uk.fsf@tcd.ie> <87o8g0ryfz.fsf@tcd.ie> <6040d37e.1c69fb81.63467.ad62@mx.google.com> <87wnun9dgo.fsf_-_@protesilaos.com> <87ft1aoj74.fsf@tcd.ie> <87eeguab7o.fsf@protesilaos.com> <81b38e8b77db937f064a@heytings.org> <7de1aeec52597093157c@heytings.org> <87o8fwfgsp.fsf@protesilaos.com> <7de1aeec5249455d448b@heytings.org> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="39334"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) Cc: 45068@debbugs.gnu.org To: Gregory Heytings Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Mar 06 19:45:10 2021 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lIbvK-000A51-7m for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 06 Mar 2021 19:45:10 +0100 Original-Received: from localhost ([::1]:53724 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lIbvJ-0001CJ-8L for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 06 Mar 2021 13:45:09 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:33670) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lIbvC-0001Bv-C6 for bug-gnu-emacs@gnu.org; Sat, 06 Mar 2021 13:45:02 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:55015) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lIbvC-0005mm-3I for bug-gnu-emacs@gnu.org; Sat, 06 Mar 2021 13:45:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1lIbvC-00052J-0Z for bug-gnu-emacs@gnu.org; Sat, 06 Mar 2021 13:45:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Protesilaos Stavrou Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 06 Mar 2021 18:45:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 45068 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 45068-submit@debbugs.gnu.org id=B45068.161505624219245 (code B ref 45068); Sat, 06 Mar 2021 18:45:01 +0000 Original-Received: (at 45068) by debbugs.gnu.org; 6 Mar 2021 18:44:02 +0000 Original-Received: from localhost ([127.0.0.1]:38321 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lIbuD-000506-EU for submit@debbugs.gnu.org; Sat, 06 Mar 2021 13:44:01 -0500 Original-Received: from relay5-d.mail.gandi.net ([217.70.183.197]:59977) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lIbuA-0004zr-Ea for 45068@debbugs.gnu.org; Sat, 06 Mar 2021 13:43:59 -0500 X-Originating-IP: 94.46.225.161 Original-Received: from kronos (unknown [94.46.225.161]) (Authenticated sender: public@protesilaos.com) by relay5-d.mail.gandi.net (Postfix) with ESMTPSA id 2A3971C0004; Sat, 6 Mar 2021 18:43:50 +0000 (UTC) In-Reply-To: <7de1aeec5249455d448b@heytings.org> (Gregory Heytings's message of "Sat, 06 Mar 2021 18:25:22 +0000") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:201662 Archived-At: On 2021-03-06, 18:25 +0000, Gregory Heytings 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]: . > (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