all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Lenny Foner <foner@media.mit.edu>
To: 3823@debbugs.gnu.org
Subject: bug#3823: skip-chars-forward "[:space:]" does not work if used after forward-comment
Date: Fri,  5 Feb 2010 01:00:29 -0500 (EST)	[thread overview]
Message-ID: <20100205060029.9A89040261@darkstar.media.mit.edu> (raw)
In-Reply-To: <e01d8a50907110834t76c22328g8f5070b4fe3cba32@mail.gmail.com>

This bug just nailed me too.  The original report was in Emacs 23, but
I'm running 22, and it doesn't work here, either, so it's obviously
been broken a long time.  Here's a toy function I was in the middle
of writing, as part of making Meta-. more to my liking:

(defun bmd-beginning-of-function-including-comments ()
  "Positions point at the start of any comments preceding the current function.
Assumes it starts at the very beginning of a definition, as Meta-. will leave us.
This is defined as all non-code lines before the current function, until we find
either another line of code, or the beginning of the buffer.  If we wind up at
the beginning of the buffer, we stop there.  If we find another line of code,
we then skip forward over any whitespace after that code, so as to land at the
first line of comments but not on any whitespace before them.  (This means that
we will skip backwards over any number of interspersed blank lines and comments
but will not waste screen real estate on a blank line when we're done.)  Narrowing
is considered, so the beginning of the buffer really means the beginning of the
accessible portion if narrowing is in effect."
  (interactive)
  (forward-comment (- (buffer-size)))
  (unless (= (point) (point-min))
    (forward-line 1)
    ;; NOTE!  Trying to use "[:space:]" instead of the regexp below DOES NOT WORK!
    ;; It only works if some other (interactive?) commands have -intervened- after the forward-comment!
    ;; Someone else has apparently tripped over this; c.f. http://debbugs.gnu.org/db/38/3823.html
    (skip-chars-forward " \t\r\n")))

This works if I use M-: to evaluate each of the forward-comment,
forward-line, and skip-chars-forward by hand, but not in the function;
after wasting a bunch of time trying to figure out if I was nuts or
Emacs was, I found this report, whose workaround works for me.

So much for trying to be elegant and actually -use- the defined syntax
classes...  Feh.  I presume that forward-comment is leaving the syntax
tables messed up in some way that gets fixed by the command-loop, or
something weird like that.

My configuration:

In GNU Emacs 22.2.1 (x86_64-pc-linux-gnu, X toolkit, Xaw3d scroll bars)
 of 2009-11-10 on yellow, modified by Ubuntu
configured using `configure  '--build=x86_64-linux-gnu' '--host=x86_64-linux-gnu' '--prefix=/usr' '--sharedstatedir=/var/lib' '--libexecdir=/usr/lib' '--localstatedir=/var' '--infodir=/usr/share/info' '--mandir=/usr/share/man' '--with-pop=yes' '--enable-locallisppath=/etc/emacs22:/etc/emacs:/usr/local/share/emacs/22.2/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/22.2/site-lisp:/usr/share/emacs/site-lisp:/usr/share/emacs/22.2/leim' '--with-x=yes' '--with-x-toolkit=athena' '--with-toolkit-scroll-bars' 'build_alias=x86_64-linux-gnu' 'host_alias=x86_64-linux-gnu' 'CFLAGS=-DDEBIAN -DSITELOAD_PURESIZE_EXTRA=5000 -g -O2' 'LDFLAGS=-g -Wl,--as-needed' 'CPPFLAGS=''

Important settings:
  value of $LC_ALL: C
  value of $LC_COLLATE: C
  value of $LC_CTYPE: nil
  value of $LC_MESSAGES: nil
  value of $LC_MONETARY: nil
  value of $LC_NUMERIC: nil
  value of $LC_TIME: nil
  value of $LANG: en_US.UTF-8
  locale-coding-system: nil
  default-enable-multibyte-characters: t

Major mode: Emacs-Lisp

Minor modes in effect:
  shell-dirtrack-mode: t
  dynamic-completion-mode: t
  show-paren-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  unify-8859-on-encoding-mode: t
  utf-translate-cjk-mode: t
  auto-compression-mode: t
  line-number-mode: t






  reply	other threads:[~2010-02-05  6:00 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-07-11 15:34 bug#3823: 23.1.50; skip-chars-forward does not move after forward-comment Lennart Borgman
2010-02-05  6:00 ` Lenny Foner [this message]
2010-03-05 18:47 ` Stefan Monnier

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=20100205060029.9A89040261@darkstar.media.mit.edu \
    --to=foner@media.mit.edu \
    --cc=3823@debbugs.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.