From: Andreas Roehler <andreas.roehler@online.de>
To: XEmacs-Beta@xemacs.org
Cc: emacs-devel@gnu.org, Stefan Monnier <monnier@IRO.UMontreal.CA>,
python-mode@python.org, "Eric M. Ludlam" <eric@siege-engine.com>
Subject: simplifying beginning-of-defun (2)
Date: Sun, 27 Sep 2009 18:07:31 +0200 [thread overview]
Message-ID: <4ABF8DC3.9030504@online.de> (raw)
Below again the code, as end-of-defun-raw had a bug last times
;; GNU's lisp.el
;; unhappily sets this var globally, ignoring its use for progmodes
(when (featurep 'emacs) (setq end-of-defun-function nil))
(setq defun-searchform '(if defun-prompt-regexp
(concat "^\\s(\\|"
"\\(" defun-prompt-regexp "\\)\\s(")
"^\\s("))
(defun beginning-of-defun (&optional arg)
"Move backward to the beginning of a functions definition. "
(interactive "P")
(or arg (setq arg 1))
(if beginning-of-defun-function
(funcall beginning-of-defun-function arg)
(beginning-of-defun-raw arg)))
(defun beginning-of-defun-raw (&optional arg)
"Called if progmodes didn't set beginning-of-defun-function. "
(when
(re-search-backward (eval defun-searchform) nil 'move (or arg 1))
(goto-char (match-beginning 0))))
(defun end-of-defun (&optional arg)
"Move backward to the end of a function. "
(interactive "P")
(or arg (setq arg 1))
(if end-of-defun-function
(funcall end-of-defun-function arg)
(end-of-defun-raw arg)))
(defun end-of-defun-raw (&optional arg)
"Called if progmodes didn't set end-of-defun-function. "
(skip-chars-forward " \t\r\n\f")
(unless (looking-at (eval defun-searchform))
(beginning-of-defun 1))
(when (re-search-forward (eval defun-searchform) nil t arg)
(goto-char (match-beginning 0))
(forward-sexp 1)))
reply other threads:[~2009-09-27 16:07 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=4ABF8DC3.9030504@online.de \
--to=andreas.roehler@online.de \
--cc=XEmacs-Beta@xemacs.org \
--cc=emacs-devel@gnu.org \
--cc=eric@siege-engine.com \
--cc=monnier@IRO.UMontreal.CA \
--cc=python-mode@python.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.