[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: XEmacs - how to automate mark-search-cut



* Tyler Smith <tyler.smith@mail.mcgill.ca> [070527 00:00]:
> Here's the code, hope it helps!
> 
> (defun extract-footnotes ()
>   "Copy all footnotes to a separate *FOOTNOTES* buffer"
>   (interactive)
>   (let ((active-buffer (current-buffer)))
>     (save-excursion
>       (if (memq (get-buffer "*FOOTNOTES*") (buffer-list))
> 	  (kill-buffer "*FOOTNOTES*"))
>       (transient-mark-mode -1)
>       (goto-char (point-min))
>       (while (search-forward "\\footnote" nil t)
> 	(goto-char (match-beginning 0))
> 	(push-mark)
> 	(search-forward "e" nil t)
> 	(forward-list)
> 	(append-to-buffer (get-buffer-create "*FOOTNOTES*") 
> 			  (mark) (point))
> 	(set-buffer "*FOOTNOTES*")
> 	(goto-char (point-max))
> 	(insert "\n")
> 	(set-buffer active-buffer)))))
 
The code runs in Emacs.  If I comment out the line
"(transient-mark-mode -1)", it also runs in XEmacs.  But in both
cases, it aborts with an "unbalanced parenthesis" error after finding
about ten footnotes (about 25 percent of the file, which is 105 kbytes
in length).  

RLH



Reply to: