[Top][All Lists]

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

oops, setting mark in program

From: Joe Corneli
Subject: oops, setting mark in program
Date: Wed, 19 Nov 2003 12:07:43 -0600

The following function and some similar functions set the mark.
Edebug seems ta say that the mark is set when the program runs

 (search-forward "\\section{" nil t)

Does this seem like the expected behavior? I can't tell from the
documentation.  Also, sorry not to provide a more minimal example,
but actually, though this is a bit long, it might be the clearest
example I have.  Maybe I have committed some other coding faux pas,
in which case, I'd be happy to see any extra constructive criticism
you might have to offer.

Thank you,

(defun xi-grab-matching-sections (regexp)
"Grab the TeX sections whose text (not including the section name) contains a 
match for this regexp."
  (interactive "MRegex: ")
      (while (not (eobp))
        (let ((found (search-forward "\\section{" nil t)))               
              (progn (let* ((begone (save-excursion (beginning-of-line)
                            (begtwo (save-excursion (end-of-line)
                            (end (save-excursion (end-of-line)
                                                 (if found
"\\section{" nil t)    ;;;;????
                                                       (beginning-of-line)) ; 
cut right before that
                                                   (end-of-buffer))  ;  and 
find the beginning of the next section
                          (entry (buffer-substring begone end)))
                     (if (equal 0 (shell-command-on-region begtwo end (concat 
"grep -q \"" regexp "\"")))
                         (progn (save-excursion (set-buffer (get-buffer-create 
                                                (insert entry))))))
          ; if we don't see another section, move to the end of the buffer to 
kill the while loop
          (if (not found)

reply via email to

[Prev in Thread] Current Thread [Next in Thread]