Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
emacs
emacs
Commits
7b952d61
Commit
7b952d61
authored
May 20, 2014
by
Stefan Monnier
Browse files
* lisp/emacs-lisp/lisp.el (end-of-defun): Ensure we move.
Fixes: debbugs:17274
parent
ebdc8031
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
27 additions
and
13 deletions
+27
-13
lisp/ChangeLog
lisp/ChangeLog
+4
-0
lisp/emacs-lisp/lisp.el
lisp/emacs-lisp/lisp.el
+23
-13
No files found.
lisp/ChangeLog
View file @
7b952d61
2014-05-20 Stefan Monnier <monnier@iro.umontreal.ca>
* emacs-lisp/lisp.el (end-of-defun): Ensure we move (bug#17274).
2014-05-18 Stefan Monnier <monnier@iro.umontreal.ca>
* emacs-lisp/timer.el (timer-event-handler): Don't run if canceled
...
...
lisp/emacs-lisp/lisp.el
View file @
7b952d61
...
...
@@ -373,16 +373,18 @@ is called as a function to find the defun's end."
(
push-mark
))
(
if
(
or
(
null
arg
)
(
=
arg
0
))
(
setq
arg
1
))
(
let
((
pos
(
point
))
(
beg
(
progn
(
end-of-line
1
)
(
beginning-of-defun-raw
1
)
(
point
))))
(
beg
(
progn
(
end-of-line
1
)
(
beginning-of-defun-raw
1
)
(
point
)))
(
skip
(
lambda
()
;; When comparing point against pos, we want to consider that if
;; point was right after the end of the function, it's still
;; considered as "in that function".
;; E.g. `eval-defun' from right after the last close-paren.
(
unless
(
bolp
)
(
skip-chars-forward
" \t"
)
(
if
(
looking-at
"\\s<\\|\n"
)
(
forward-line
1
))))))
(
funcall
end-of-defun-function
)
;; When comparing point against pos, we want to consider that if
;; point was right after the end of the function, it's still
;; considered as "in that function".
;; E.g. `eval-defun' from right after the last close-paren.
(
unless
(
bolp
)
(
skip-chars-forward
" \t"
)
(
if
(
looking-at
"\\s<\\|\n"
)
(
forward-line
1
)))
(
funcall
skip
)
(
cond
((
>
arg
0
)
;; Moving forward.
...
...
@@ -405,11 +407,19 @@ is called as a function to find the defun's end."
(
goto-char
beg
))
(
unless
(
zerop
arg
)
(
beginning-of-defun-raw
(
-
arg
))
(
setq
beg
(
point
))
(
funcall
end-of-defun-function
))))
(
unless
(
bolp
)
(
skip-chars-forward
" \t"
)
(
if
(
looking-at
"\\s<\\|\n"
)
(
forward-line
1
)))))
(
funcall
skip
)
(
while
(
and
(
<
arg
0
)
(
>=
(
point
)
pos
))
;; We intended to move backward, but this ended up not doing so:
;; Try harder!
(
goto-char
beg
)
(
beginning-of-defun-raw
(
-
arg
))
(
if
(
>=
(
point
)
beg
)
(
setq
arg
0
)
(
setq
beg
(
point
))
(
funcall
end-of-defun-function
)
(
funcall
skip
)))))
(
defun
mark-defun
(
&optional
allow-extend
)
"Put mark at end of this defun, point at beginning.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment