From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Gregory Heytings Newsgroups: gmane.emacs.bugs Subject: bug#45068: [PATCH] Modus themes 1.2.0 Date: Sat, 06 Mar 2021 18:25:22 +0000 Message-ID: <7de1aeec5249455d448b@heytings.org> References: <87im9fgm27.fsf@protesilaos.com> <87tupyw83e.fsf@protesilaos.com> <83zgzqncxx.fsf@gnu.org> <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> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="38440"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 45068@debbugs.gnu.org To: Protesilaos Stavrou Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Mar 06 19:26:12 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 1lIbcx-0009og-Ee for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 06 Mar 2021 19:26:11 +0100 Original-Received: from localhost ([::1]:39974 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lIbcv-0002QZ-W5 for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 06 Mar 2021 13:26:10 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:58378) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lIbco-0002QI-Cs for bug-gnu-emacs@gnu.org; Sat, 06 Mar 2021 13:26:02 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:54960) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lIbco-0000Ar-5Z for bug-gnu-emacs@gnu.org; Sat, 06 Mar 2021 13:26:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1lIbco-0004WT-25 for bug-gnu-emacs@gnu.org; Sat, 06 Mar 2021 13:26:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Gregory Heytings Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 06 Mar 2021 18:26: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.161505512717339 (code B ref 45068); Sat, 06 Mar 2021 18:26:01 +0000 Original-Received: (at 45068) by debbugs.gnu.org; 6 Mar 2021 18:25:27 +0000 Original-Received: from localhost ([127.0.0.1]:38273 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lIbcF-0004Va-D4 for submit@debbugs.gnu.org; Sat, 06 Mar 2021 13:25:27 -0500 Original-Received: from heytings.org ([95.142.160.155]:45820) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lIbcD-0004VQ-6X for 45068@debbugs.gnu.org; Sat, 06 Mar 2021 13:25:26 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=heytings.org; s=20210101; t=1615055123; bh=2a5/Eif+heND1AoAujai8d8iLkVphD/Q/jWSvv8b48Y=; h=Date:From:To:cc:Subject:In-Reply-To:Message-ID:References:From; b=mlAW8L3pTyJ5v4SojFBB6ut8McMftDAfbIsX7Uu6n6Yb3pNiF1uPLGZDCZ9syVAS4 kXbH9RpmuYV9puEjWeYhPPMIYZWtF4TpQJWWqDFPaZQAAIY9InKqhUSNzVYWmDgLQK XlPYxjFjMYJYJOdFgqcxVOF1fSzuzZQyYGpj/JDPPIt0xrX+wsy5VBD4BgESN3Xewt jcRFHi+HGFE2QDYKbUpaTbICmj90T95C4Elm33KHBz5fAv3jcNA8bP5r3WkVBqEWDq GhuDYX9wgHh8xWJeL6zd4vuliA1VK6hKQnITNbC+Kc93i5Zy/vjUPTjMBO8TeaQsfW ZrIT2COGH181A== In-Reply-To: <87o8fwfgsp.fsf@protesilaos.com> 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:201654 Archived-At: > > 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)))) (BTW, sorry for the off-topic noise on your thread on modus-themes, but it was you who asked for a solution ;-))