all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* mark-defun bug
@ 2008-04-01 12:42 Andreas Röhler
  2008-04-02  8:19 ` Andreas Röhler
  0 siblings, 1 reply; 2+ messages in thread
From: Andreas Röhler @ 2008-04-01 12:42 UTC (permalink / raw)
  To: emacs-devel

[-- Attachment #1: Type: text/plain, Size: 219 bytes --]


Hi all,

`mark-defun' misses the last char, if a definition is
followed by a buffer-end.

As this bug seems caused by a line not needed, IMO it's
fine to drop it.

Patch attached.

Thanks

Andreas Röhler

[-- Attachment #2: emacs-mark-defun.diff --]
[-- Type: text/x-diff, Size: 489 bytes --]

diff -u -b /old/lisp.el /new/lisp.el
--- /old/lisp.el	2008-03-22 01:10:59.000000000 +0100
+++ /new/lisp.el	2008-04-01 14:15:18.000000000 +0200
@@ -400,8 +400,7 @@
 	     (goto-char opoint)
 	     (end-of-defun)
 	     (push-mark (point) nil t)
-	     (beginning-of-defun))
-	   (re-search-backward "^\n" (- (point) 1) t)))))
+	     (beginning-of-defun))))))
 
 (defun narrow-to-defun (&optional arg)
   "Make text outside current defun invisible.

Diff finished.  Tue Apr  1 14:15:45 2008

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: mark-defun bug
  2008-04-01 12:42 mark-defun bug Andreas Röhler
@ 2008-04-02  8:19 ` Andreas Röhler
  0 siblings, 0 replies; 2+ messages in thread
From: Andreas Röhler @ 2008-04-02  8:19 UTC (permalink / raw)
  To: emacs-devel

Am Dienstag, 1. April 2008 14:42 schrieb Andreas Röhler:
> 
> Hi all,
> 
> `mark-defun' misses the last char, if a definition is
> followed by a buffer-end.
> 
> As this bug seems caused by a line not needed, IMO it's
> fine to drop it.
> 
> Patch attached.
> 
> Thanks
> 
> Andreas Röhler
> 

Can't reproduce the bug this morning, sorry. So maybe
forget it.

What I remember is the result of `comment-dwim' after
`mark-defun' was called:

; (defun foo (&optional arg ispec) 
;   " "
;   (interactive "*P\np")
;   (when arg (message "arg: %s" arg))
;   (if ispec
;       (message "%s" "interactive call")
;     nil)
  )

The last parenthese wasn't catched, it was set onto a
newline.

That doesn't happen any more.

Remains to notice: extension of region after of
`mark-defun' is one char larger than (substring beg
end) of function at point.

That's due to 

(re-search-backward "^\n" (- (point) 1) t)

whose possible harms may outweigh possible benefits.

Thanks all

Andreas Röhler




^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2008-04-02  8:19 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-04-01 12:42 mark-defun bug Andreas Röhler
2008-04-02  8:19 ` Andreas Röhler

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.