From: Jim Porter <jporterbugs@gmail.com>
To: Juri Linkov <juri@linkov.net>
Cc: 68881@debbugs.gnu.org
Subject: bug#68881: 30.0.50; [PATCH] Field properties confuse 'outline-minor-mode'
Date: Sun, 11 Feb 2024 10:19:18 -0800 [thread overview]
Message-ID: <45bf907f-f5b7-9bbb-ada2-43f262902029@gmail.com> (raw)
In-Reply-To: <86y1bqx5jr.fsf@mail.linkov.net>
[-- Attachment #1: Type: text/plain, Size: 380 bytes --]
On 2/11/2024 9:40 AM, Juri Linkov wrote:
>> @@ -725,7 +725,7 @@ outline-insert-heading
>> (not (string-match (concat "\\`\\(?:" outline-regexp "\\)")
>> (concat head " "))))
>> (setq head (concat head " ")))
>> - (unless (bolp) (end-of-line) (newline))
>> + (unless (bolp) (goto-char (pos-bol)) (newline))
>
> This looks like a typo.
So it is. Fixed.
[-- Attachment #2: 0001-Make-outline.el-ignore-field-properties-in-text.patch --]
[-- Type: text/plain, Size: 4687 bytes --]
From 6dc4b7802ef36a50647ebf2a1e9a1982fb9edbb3 Mon Sep 17 00:00:00 2001
From: Jim Porter <jporterbugs@gmail.com>
Date: Thu, 1 Feb 2024 13:58:20 -0800
Subject: [PATCH 1/4] Make outline.el ignore field properties in text
* lisp/outline.el (outline-back-to-heading, outline-on-heading-p)
(outline-next-visible-heading, outline-mark-subtree)
(outline-hide-sublevels, outline--insert-button)
(outline--fix-up-all-buttons): Inhibit field text motion (bug#68881).
---
lisp/outline.el | 24 +++++++++++-------------
1 file changed, 11 insertions(+), 13 deletions(-)
diff --git a/lisp/outline.el b/lisp/outline.el
index b50708c1a7b..5ac0f0707f1 100644
--- a/lisp/outline.el
+++ b/lisp/outline.el
@@ -686,7 +686,7 @@ 'outline-before-first-heading
(defun outline-back-to-heading (&optional invisible-ok)
"Move to previous heading line, or beg of this line if it's a heading.
Only visible heading lines are considered, unless INVISIBLE-OK is non-nil."
- (beginning-of-line)
+ (forward-line 0)
(or (outline-on-heading-p invisible-ok)
(let (found)
(save-excursion
@@ -705,7 +705,7 @@ outline-on-heading-p
"Return t if point is on a (visible) heading line.
If INVISIBLE-OK is non-nil, an invisible heading line is ok too."
(save-excursion
- (beginning-of-line)
+ (forward-line 0)
(and (bolp) (or invisible-ok (not (outline-invisible-p)))
(if outline-search-function
(funcall outline-search-function nil nil nil t)
@@ -725,7 +725,7 @@ outline-insert-heading
(not (string-match (concat "\\`\\(?:" outline-regexp "\\)")
(concat head " "))))
(setq head (concat head " ")))
- (unless (bolp) (end-of-line) (newline))
+ (unless (bolp) (goto-char (pos-eol)) (newline))
(insert head)
(unless (eolp)
(save-excursion (newline-and-indent)))
@@ -941,9 +941,7 @@ outline-next-visible-heading
A heading line is one that starts with a `*' (or that
`outline-regexp' matches)."
(interactive "p")
- (if (< arg 0)
- (beginning-of-line)
- (end-of-line))
+ (goto-char (if (< arg 0) (pos-bol) (pos-eol)))
(let ((regexp (unless outline-search-function
(concat "^\\(?:" outline-regexp "\\)")))
found-heading-p)
@@ -963,7 +961,7 @@ outline-next-visible-heading
(re-search-forward regexp nil 'move)))
(outline-invisible-p (match-beginning 0))))
(setq arg (1- arg)))
- (if found-heading-p (beginning-of-line))))
+ (if found-heading-p (forward-line 0))))
(defun outline-previous-visible-heading (arg)
"Move to the previous heading line.
@@ -980,7 +978,7 @@ outline-mark-subtree
(let ((beg))
(if (outline-on-heading-p)
;; we are already looking at a heading
- (beginning-of-line)
+ (forward-line 0)
;; else go back to previous heading
(outline-previous-visible-heading 1))
(setq beg (point))
@@ -1183,7 +1181,7 @@ outline-hide-sublevels
(cond
(current-prefix-arg (prefix-numeric-value current-prefix-arg))
((save-excursion
- (beginning-of-line)
+ (forward-line 0)
(if outline-search-function
(funcall outline-search-function nil nil nil t)
(looking-at outline-regexp)))
@@ -1243,7 +1241,7 @@ outline-toggle-children
(interactive)
(save-excursion
(outline-back-to-heading)
- (if (not (outline-invisible-p (line-end-position)))
+ (if (not (outline-invisible-p (pos-eol)))
(outline-hide-subtree)
(outline-show-children)
(outline-show-entry))))
@@ -1834,7 +1832,7 @@ outline--create-button-icons
(defun outline--insert-button (type)
(with-silent-modifications
(save-excursion
- (beginning-of-line)
+ (forward-line 0)
(let ((icon (nth (if (eq type 'close) 1 0) outline--button-icons))
(o (seq-find (lambda (o) (overlay-get o 'outline-button))
(overlays-at (point)))))
@@ -1842,7 +1840,7 @@ outline--insert-button
(when (eq outline-minor-mode-use-buttons 'insert)
(let ((inhibit-read-only t))
(insert (apply #'propertize " " (text-properties-at (point))))
- (beginning-of-line)))
+ (forward-line 0)))
(setq o (make-overlay (point) (1+ (point))))
(overlay-put o 'outline-button t)
(overlay-put o 'evaporate t))
@@ -1866,7 +1864,7 @@ outline--fix-up-all-buttons
(when from
(save-excursion
(goto-char from)
- (setq from (line-beginning-position))))
+ (setq from (pos-bol))))
(outline-map-region
(lambda ()
(let ((close-p (save-excursion
--
2.25.1
next prev parent reply other threads:[~2024-02-11 18:19 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-01 23:51 bug#68881: 30.0.50; [PATCH] Field properties confuse 'outline-minor-mode' Jim Porter
2024-02-07 17:37 ` Juri Linkov
2024-02-10 18:22 ` Jim Porter
2024-02-10 19:23 ` Eli Zaretskii
2024-02-10 21:14 ` Jim Porter
2024-02-11 6:07 ` Eli Zaretskii
2024-02-11 7:08 ` Jim Porter
2024-02-11 17:40 ` Juri Linkov
2024-02-11 18:19 ` Jim Porter [this message]
2024-02-12 18:25 ` Juri Linkov
2024-02-13 4:03 ` Jim Porter
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=45bf907f-f5b7-9bbb-ada2-43f262902029@gmail.com \
--to=jporterbugs@gmail.com \
--cc=68881@debbugs.gnu.org \
--cc=juri@linkov.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.