From: Sean O'Rourke <sorourke@cs.ucsd.edu>
Subject: Re: Mysterious fontification/C++ context issue - Patch for beginning-of-defun-raw.
Date: Thu, 14 Dec 2006 22:31:37 -0800 [thread overview]
Message-ID: <m2vekdmzzq.fsf@cs.ucsd.edu> (raw)
In-Reply-To: E1Gv5E4-0000Ei-La@fencepost.gnu.org
[-- Attachment #1: Type: text/plain, Size: 444 bytes --]
Richard Stallman <rms@gnu.org> writes:
> Should C mode do (setq beginning-of-defun-function
> 'c-beginning-of-defun) Is there any reason that would be bad?
As the code currently stands, this goes into infinite recursion
when c-beginning-of-defun calls beginning-of-defun (likewise for
end-of-defun{,-function}). I've fixed this locally by
let-binding {beginning,end}-of-defun-function, which seems like a
reasonable solution (attached).
/s
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Type: text/x-patch, Size: 2127 bytes --]
Index: lisp.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/emacs-lisp/lisp.el,v
retrieving revision 1.76
diff -u -r1.76 lisp.el
--- lisp.el 7 Dec 2006 04:47:47 -0000 1.76
+++ lisp.el 15 Dec 2006 06:22:10 -0000
@@ -208,17 +208,18 @@
If variable `beginning-of-defun-function' is non-nil, its value
is called as a function to find the defun's beginning."
- (interactive "p") ; change this to "P", maybe, if we ever come to pass ARG
- ; to beginning-of-defun-function.
- (unless arg (setq arg 1)) ; The call might not be interactive.
+ (interactive "p")
+ (setq arg (or arg 1))
(cond
- (beginning-of-defun-function
- (if (> arg 0)
- (dotimes (i arg)
- (funcall beginning-of-defun-function))
- ;; Better not call end-of-defun-function directly, in case
- ;; it's not defined.
- (end-of-defun (- arg))))
+ (beginning-of-defun-function
+ (let ((bodf beginning-of-defun-function)
+ beginning-of-defun-function)
+ (if (> (setq arg (or arg 1)) 0)
+ (dotimes (i arg)
+ (funcall bodf))
+ ;; Better not call end-of-defun-function directly, in case
+ ;; it's not defined.
+ (end-of-defun (- arg)))))
((or defun-prompt-regexp open-paren-in-column-0-is-defun-start)
(and (< arg 0) (not (eobp)) (forward-char 1))
@@ -297,12 +298,14 @@
(push-mark))
(if (or (null arg) (= arg 0)) (setq arg 1))
(if end-of-defun-function
- (if (> arg 0)
- (dotimes (i arg)
- (funcall end-of-defun-function))
- ;; Better not call beginning-of-defun-function
- ;; directly, in case it's not defined.
- (beginning-of-defun (- arg)))
+ (let ((eodf end-of-defun-function)
+ end-of-defun-function)
+ (if (> arg 0)
+ (dotimes (i arg)
+ (funcall eodf))
+ ;; Better not call beginning-of-defun-function
+ ;; directly, in case it's not defined.
+ (beginning-of-defun (- arg))))
(let ((first t))
(while (and (> arg 0) (< (point) (point-max)))
(let ((pos (point)))
[-- 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-12-15 6:31 UTC|newest]
Thread overview: 68+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-12-15 5:03 Mysterious fontification/C++ context issue - Patch for beginning-of-defun-raw Richard Stallman
2006-12-15 6:31 ` Sean O'Rourke [this message]
2006-12-15 16:08 ` Chong Yidong
2006-12-15 16:16 ` Sean O'Rourke
2006-12-15 16:44 ` Chong Yidong
2006-12-15 20:46 ` Stuart D. Herring
2006-12-15 21:24 ` Richard Stallman
2006-12-15 22:31 ` Sean O'Rourke
2006-12-15 16:57 ` Chong Yidong
2006-12-15 23:33 ` Stefan Monnier
[not found] <45742464.1090504@gmx.at>
2006-12-04 21:17 ` Mysterious fontification/C++ context issue Alan Mackenzie
2006-12-06 9:04 ` martin rudalics
2006-12-06 12:22 ` Kim F. Storm
2006-12-06 16:31 ` Chong Yidong
2006-12-07 4:59 ` Richard Stallman
2006-12-10 0:35 ` Alan Mackenzie
2006-12-10 1:11 ` Chong Yidong
2006-12-10 9:12 ` Alan Mackenzie
2006-12-10 20:30 ` Chong Yidong
2006-12-13 21:29 ` Mysterious fontification/C++ context issue - Patch for beginning-of-defun-raw Alan Mackenzie
2006-12-14 1:02 ` Chong Yidong
2006-12-14 7:36 ` Alan Mackenzie
2006-12-14 10:47 ` martin rudalics
2006-12-14 18:26 ` Alan Mackenzie
2006-12-14 18:53 ` David Kastrup
2006-12-14 20:21 ` Chong Yidong
2006-12-14 20:35 ` Chong Yidong
2006-12-14 22:18 ` Alan Mackenzie
2006-12-14 22:51 ` Chong Yidong
2006-12-15 0:53 ` David Kastrup
2006-12-15 10:35 ` Johan Bockgård
2006-12-15 7:32 ` martin rudalics
2006-12-15 19:22 ` Alan Mackenzie
2006-12-15 22:20 ` David Kastrup
2006-12-16 10:17 ` martin rudalics
2006-12-17 11:44 ` Alan Mackenzie
2006-12-17 12:02 ` David Kastrup
2006-12-17 12:08 ` Alan Mackenzie
2006-12-17 12:14 ` David Kastrup
2006-12-17 12:26 ` Alan Mackenzie
2006-12-17 12:51 ` David Kastrup
2006-12-17 17:28 ` martin rudalics
2006-12-18 0:06 ` Stefan Monnier
2006-12-15 23:24 ` Stefan Monnier
2006-12-16 10:17 ` martin rudalics
2006-12-16 18:14 ` Chong Yidong
2006-12-16 18:27 ` martin rudalics
2006-12-16 19:00 ` martin rudalics
2006-12-16 19:33 ` Chong Yidong
2006-12-16 19:59 ` martin rudalics
2006-12-16 20:10 ` Chong Yidong
2006-12-16 21:26 ` Chong Yidong
2006-12-16 22:43 ` martin rudalics
2006-12-16 23:30 ` Stefan Monnier
2006-12-16 23:40 ` martin rudalics
2006-12-17 0:04 ` Stefan Monnier
2006-12-17 4:02 ` Chong Yidong
2006-12-17 10:32 ` martin rudalics
2006-12-17 10:26 ` martin rudalics
2006-12-17 10:59 ` David Kastrup
2006-12-17 23:23 ` Stefan Monnier
2006-12-17 11:10 ` Alan Mackenzie
2006-12-17 12:01 ` David Kastrup
2006-12-18 0:04 ` Stefan Monnier
2006-12-16 22:11 ` martin rudalics
2006-12-16 23:29 ` Stefan Monnier
2006-12-16 23:37 ` martin rudalics
2006-12-16 20:22 ` David Kastrup
2006-12-16 22:21 ` martin rudalics
2006-12-14 17:29 ` Chong Yidong
2006-12-14 18:56 ` David Kastrup
2006-12-14 22:57 ` Alan Mackenzie
2006-12-15 22:56 ` Stefan Monnier
2006-12-15 23:03 ` David Kastrup
2006-12-14 10:45 ` martin rudalics
2006-12-14 18:29 ` Alan Mackenzie
2006-12-15 22:49 ` 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=m2vekdmzzq.fsf@cs.ucsd.edu \
--to=sorourke@cs.ucsd.edu \
/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.