all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Re: [elpa] externals/rec-mode e06fafdfb9 1/2: rec-mode.el: do not use looking-back in rec-beginning-of-field-pos
       [not found] ` <20231120145846.2B67DC0C1BE@vcs2.savannah.gnu.org>
@ 2023-11-20 17:25   ` Stefan Monnier
  2023-11-20 22:20     ` Jose E. Marchesi
  0 siblings, 1 reply; 2+ messages in thread
From: Stefan Monnier @ 2023-11-20 17:25 UTC (permalink / raw)
  To: Jose E. Marchesi; +Cc: emacs-devel

> +    (while (and (not (= (line-beginning-position) 1))
> +                (or (looking-at "\\+")
> +                    (and (> (point) 1)
> +                         (save-excursion
> +                           (backward-char 2)
> +                           (looking-at "\\\\\n")))))

Better avoid hard coded buffer positions, since they break down in
narrowed buffers:

    (while (and (not (= (line-beginning-position) (point-min)))
                (or (looking-at "\\+")
                    (and (not (bobp))
                         (save-excursion
                           (backward-char 2)
                           (looking-at "\\\\\n")))))


-- Stefan




^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [elpa] externals/rec-mode e06fafdfb9 1/2: rec-mode.el: do not use looking-back in rec-beginning-of-field-pos
  2023-11-20 17:25   ` [elpa] externals/rec-mode e06fafdfb9 1/2: rec-mode.el: do not use looking-back in rec-beginning-of-field-pos Stefan Monnier
@ 2023-11-20 22:20     ` Jose E. Marchesi
  0 siblings, 0 replies; 2+ messages in thread
From: Jose E. Marchesi @ 2023-11-20 22:20 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: Jose E. Marchesi, emacs-devel


Hi Stefan.

Good (point)!
I just pushed your fix.  Thank you!

>> +    (while (and (not (= (line-beginning-position) 1))
>> +                (or (looking-at "\\+")
>> +                    (and (> (point) 1)
>> +                         (save-excursion
>> +                           (backward-char 2)
>> +                           (looking-at "\\\\\n")))))
>
> Better avoid hard coded buffer positions, since they break down in
> narrowed buffers:
>
>     (while (and (not (= (line-beginning-position) (point-min)))
>                 (or (looking-at "\\+")
>                     (and (not (bobp))
>                          (save-excursion
>                            (backward-char 2)
>                            (looking-at "\\\\\n")))))
>
>
> -- Stefan



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-11-20 22:20 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <170049232573.19582.9641540634313938438@vcs2.savannah.gnu.org>
     [not found] ` <20231120145846.2B67DC0C1BE@vcs2.savannah.gnu.org>
2023-11-20 17:25   ` [elpa] externals/rec-mode e06fafdfb9 1/2: rec-mode.el: do not use looking-back in rec-beginning-of-field-pos Stefan Monnier
2023-11-20 22:20     ` Jose E. Marchesi

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.