From: Ken Manheimer <ken.manheimer@gmail.com>
Cc: emacs-devel@gnu.org
Subject: Re: move-beginning-of-line misbehaves on wrapped-line invisible text - recent cvs checkout
Date: Mon, 23 Jan 2006 13:17:14 -0500 [thread overview]
Message-ID: <2cd46e7f0601231017h65e30274x18504d460d5d8042@mail.gmail.com> (raw)
In-Reply-To: <2cd46e7f0601220812v53945980x8d045c3df55e5f2c@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 2832 bytes --]
On 1/22/06, Ken Manheimer <ken.manheimer@gmail.com> wrote:
> this works for me!
... but i've discovered what i think is a bug in rms' new
move-beginning-of-line code.
i'm attaching another bit of elisp to construct a demonstration. it
appears that move-beginning-of-line will _sometimes_ go to the wrong
place - the beginning of the buffer, in this case - if hidden text
it's traversing begins with a newline.
my best guess at a fix for the recent move-beginning-of-lines would be
to remove the first
(skip-chars-backward "^\n")
- the one before the loop. that resolves both this current problem
and the previous one i demonstrated. unfortunately, i can't be
confident about any fix i invent, because i'm hazy about some of the
contingencies move-beginning-of-line is supposed to handle - i don't
know enough about fields, and am still a bit unclear about some
wording in the function's docstring and rms explanation.
(gmail may be preventing sending of application/octet-stream
attachments, which is how it recognizes .el files, so the attachment
may be omitted. if so, i'll resend with the attachment as a text
file.)
> On 1/19/06, Richard M. Stallman <rms@gnu.org> wrote:
> > move-beginning-of-line is supposed to move to the beginning of the
> > current _display_ line. emphasis on "display" is because i'm not
> > quite clear what it means.
> >
> > I believe the idea is that newlines that don't really appear as such
> > do not count.
> >
> > I don't see the problems you reported with the medium-size lines,
> > but I do see the problem with the longest line. This seems to fix it.
> > Does this give good results in general?
>
> i see none of the problems that had been showing without the patch. i
> haven't exercised emacs very much with the change, but see that it's
> already in CVS. i'll report if i encounter any problems with it.
> thanks!
>
> ken
>
> > *** simple.el 05 Jan 2006 10:48:16 -0500 1.783
> > --- simple.el 19 Jan 2006 12:11:57 -0500
> > ***************
> > *** 3734,3740 ****
> > (or arg (setq arg 1))
> > (if (/= arg 1)
> > (line-move (1- arg) t))
> > ! (beginning-of-line 1)
> > (let ((orig (point)))
> > (vertical-motion 0)
> > (if (/= orig (point))
> > --- 3735,3747 ----
> > (or arg (setq arg 1))
> > (if (/= arg 1)
> > (line-move (1- arg) t))
> > !
> > ! ;; Move to beginning-of-line, ignoring fields and invisibles.
> > ! (skip-chars-backward "^\n")
> > ! (while (and (not (bobp)) (line-move-invisible-p (1- (point))))
> > ! (goto-char (previous-char-property-change (1- (point))))
> > ! (skip-chars-backward "^\n"))
> > !
> > (let ((orig (point)))
> > (vertical-motion 0)
> > (if (/= orig (point))
> >
>
[-- Attachment #2: overlay-prob2.el --]
[-- Type: application/octet-stream, Size: 1301 bytes --]
(defvar overlay-prob-category nil
"Variable for demonstrating overlay problem w/categories")
(setplist 'overlay-prob-category nil)
(put 'overlay-prob-category 'invisible 'outline)
(defun construct-overlay-problem ()
(interactive)
(let* ((buffer (get-buffer-create "overlay-problem"))
beg
offset
ol)
(pop-to-buffer buffer)
(erase-buffer)
(outline-mode)
(insert "This may demonstrate a bug in move-beginning-of-line\n")
(insert "(actually, previous-char-property-change). In my emacs 20.0.50\n")
(insert "build (CVS as of 22Jan2006), a property change is skipped.\n")
(insert "Follow these instructions for a demonstration.\n")
(insert "\n")
(insert "At the end of the last line, after the hidden text, do a\n")
(insert "move-beginning-of-line")
(insert (substitute-command-keys "(\\[move-beginning-of-line])\n\n"))
(insert "In my build, the cursor goes to the beginning of the buffer.\n")
(insert "\n")
(insert (substitute-command-keys "Do \\[move-beginning-of-line]"))
(insert " at the end of this line ")
(setq beg (point))
(insert "\n some characters *including leading newline* to hide")
(setq ol (make-overlay beg (point)))
(overlay-put ol 'category 'overlay-prob-category)))
[-- Attachment #3: Type: text/plain, Size: 142 bytes --]
_______________________________________________
Emacs-devel mailing list
Emacs-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-devel
next prev parent reply other threads:[~2006-01-23 18:17 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-01-13 0:12 move-beginning-of-line misbehaves on wrapped-line invisible text - recent cvs checkout Ken Manheimer
2006-01-19 17:45 ` Richard M. Stallman
2006-01-22 16:12 ` Ken Manheimer
2006-01-23 18:17 ` Ken Manheimer [this message]
2006-01-23 20:47 ` Ken Manheimer
2006-01-26 3:28 ` Lőrentey Károly
2006-01-27 0:19 ` Ken Manheimer
2006-01-30 18:46 ` Richard M. Stallman
2006-01-31 19:10 ` Ken Manheimer
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=2cd46e7f0601231017h65e30274x18504d460d5d8042@mail.gmail.com \
--to=ken.manheimer@gmail.com \
--cc=emacs-devel@gnu.org \
/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.