+2004-09-01 Juri Linkov <juri@jurta.org>
+
+ * isearch.el (isearch-wrap-function)
+ (isearch-push-state-function): New defvars.
+ (isearch-pop-fun-state): New defsubst.
+ (isearch-top-state): Call function saved in `isearch-pop-fun-state'.
+ (isearch-push-state): Set the result of calling
+ `isearch-push-state-function' to the `isearch-pop-fun-state' field.
+ (isearch-cancel): Call function saved in `isearch-pop-fun-state' to
+ restore the mode-specific starting point of terminated search.
+ (isearch-abort): Call `isearch-cancel' instead of its duplicated code.
+ (isearch-repeat): Call `isearch-wrap-function' if defined.
+ (isearch-message-prefix): Don't add prefix "over" to the message
+ for wrapped search if `isearch-wrap-function' is defined.
+ (isearch-search): Call function saved in `isearch-pop-fun-state' to
+ restore the mode-specific starting point of failed search.
+
+ * info.el (Info-search-whitespace-regexp): Fix backslashes.
+ (Info-search): Add new optional arguments for the sake of isearch.
+ Replace whitespace in Info-search-whitespace-regexp literally.
+ Add backward search. Don't call `Info-select-node' if regexp is
+ found in the same Info node. Don't add node to Info-history for
+ wrapped isearch.
+ (Info-search-backward, Info-isearch-search, Info-isearch-wrap)
+ (Info-isearch-push-state, Info-isearch-pop-state): New funs.
+ (Info-mode): Set local variables `isearch-search-fun-function',
+ `isearch-wrap-function', `isearch-push-state-function',
+ `search-whitespace-regexp'.
+
+ * isearch.el: Remove ancient Change Log section.
+ (isearch-string, isearch-message-string, isearch-point)
+ (isearch-success, isearch-forward-flag, isearch-other-end)
+ (isearch-word, isearch-invalid-regexp, isearch-wrapped)
+ (isearch-barrier, isearch-within-brackets)
+ (isearch-case-fold-search): Add suffix `-state' to state-related
+ defsubsts to avoid name clashes with other function names.
+
+ * simple.el (next-error): New defgroup and defface.
+ (next-error-highlight, next-error-highlight-no-select):
+ New defcustoms.
+ (next-error-no-select): Let-bind next-error-highlight to the value
+ of next-error-highlight-no-select before calling `next-error'.
+
+ * progmodes/compile.el (compilation-goto-locus):
+ Use `next-error' face instead of `region'. Set 4-th argument of
+ `move-overlay' to `current-buffer' to move overlay to different
+ source buffers. Use new variable `next-error-highlight'.
+
+ * simple.el (next-error-find-buffer): Move the rule
+ "if current buffer is a next-error capable buffer" after the
+ rule "if next-error-last-buffer is set to a live buffer".
+ Simplify to test all rules in one `or'.
+ (next-error): Doc fix.
+ (next-error, previous-error, first-error)
+ (next-error-no-select, previous-error-no-select):
+ Make arguments optional.
+
2004-08-31 Luc Teirlinck <teirllm@auburn.edu>
* macros.el (apply-macro-to-region-lines): Make it operate on all
(ps-generate-string-list): Comment fix.
(ps-message-log-max): Code fix.
-
2004-07-22 Michael Piotrowski <mxp@dynalabs.de> (tiny change)
* ps-print.el (ps-begin-file): Improve the DSC compliance of the
2004-07-20 Richard M. Stallman <rms@gnu.org>
- * textmodes/fill.el (fill-comment-paragraph): Handle indent-tabs-mode.
- (fill-delete-newlines): Call sentence-end as function.
- (fill-nobreak-p, canonically-space-region): Likewise.
- (fill-nobreak-p): If this break point is at the end of the line,
- don't consider the newline which follows as a reason to return t.
+ * textmodes/fill.el (fill-nobreak-p): If this break point is
+ at the end of the line, don't consider the newline which follows
+ as a reason to return t.
2004-07-19 John Paul Wallington <jpw@gnu.org>
;; keep the behavior. No point in forcing nonincremental search until
;; the last possible moment.
-;; TODO
-;; - Integrate the emacs 19 generalized command history.
-;; - Hooks and options for failed search.
-
;;; Code:
\f
(defvar isearch-mode-end-hook nil
"Function(s) to call after terminating an incremental search.")
+(defvar isearch-wrap-function nil
+ "Function to call to wrap the search when search is failed.
+If nil, move point to the beginning of the buffer for a forward search,
+or to the end of the buffer for a backward search.")
+
+(defvar isearch-push-state-function nil
+ "Function to save a function restoring the mode-specific isearch state
+to the search status stack.")
+
;; Search ring.
(defvar search-ring nil
(defsubst isearch-case-fold-search-state (frame)
"Return the case-folding flag in FRAME."
(aref frame 11))
+(defsubst isearch-pop-fun-state (frame)
+ "Return the function restoring the mode-specific isearch state in FRAME."
+ (aref frame 12))
(defun isearch-top-state ()
(let ((cmd (car isearch-cmds)))
isearch-barrier (isearch-barrier-state cmd)
isearch-within-brackets (isearch-within-brackets-state cmd)
isearch-case-fold-search (isearch-case-fold-search-state cmd))
+ (if (functionp (isearch-pop-fun-state cmd))
+ (funcall (isearch-pop-fun-state cmd) cmd))
(goto-char (isearch-point-state cmd))))
(defun isearch-pop-state ()
isearch-success isearch-forward isearch-other-end
isearch-word
isearch-invalid-regexp isearch-wrapped isearch-barrier
- isearch-within-brackets isearch-case-fold-search)
+ isearch-within-brackets isearch-case-fold-search
+ (if isearch-push-state-function
+ (funcall isearch-push-state-function)))
isearch-cmds)))
\f
(defun isearch-cancel ()
"Terminate the search and go back to the starting point."
(interactive)
+ (if (functionp (isearch-pop-fun-state (car (last isearch-cmds))))
+ (funcall (isearch-pop-fun-state (car (last isearch-cmds)))
+ (car (last isearch-cmds))))
(goto-char isearch-opoint)
- (isearch-done t)
+ (isearch-done t) ; exit isearch
(isearch-clean-overlays)
- (signal 'quit nil)) ; and pass on quit signal
+ (signal 'quit nil)) ; and pass on quit signal
(defun isearch-abort ()
"Abort incremental search mode if searching is successful, signaling quit.
(if isearch-success
;; If search is successful, move back to starting point
;; and really do quit.
- (progn (goto-char isearch-opoint)
- (setq isearch-success nil)
- (isearch-done t) ; exit isearch
- (isearch-clean-overlays)
- (signal 'quit nil)) ; and pass on quit signal
+ (progn
+ (setq isearch-success nil)
+ (isearch-cancel))
;; If search is failing, or has an incomplete regexp,
;; rub out until it is once more successful.
(while (or (not isearch-success) isearch-invalid-regexp)
;; If already have what to search for, repeat it.
(or isearch-success
(progn
- (goto-char (if isearch-forward (point-min) (point-max)))
+ (if isearch-wrap-function
+ (funcall isearch-wrap-function)
+ (goto-char (if isearch-forward (point-min) (point-max))))
(setq isearch-wrapped t))))
;; C-s in reverse or C-r in forward, change direction.
(setq isearch-forward (not isearch-forward)))
(or isearch-success (setq ellipsis nil))
(let ((m (concat (if isearch-success "" "failing ")
(if (and isearch-wrapped
+ (not isearch-wrap-function)
(if isearch-forward
(> (point) isearch-opoint)
(< (point) isearch-opoint)))
;; Ding if failed this time after succeeding last time.
(and (isearch-success-state (car isearch-cmds))
(ding))
+ (if (functionp (isearch-pop-fun-state (car isearch-cmds)))
+ (funcall (isearch-pop-fun-state (car isearch-cmds)) (car isearch-cmds)))
(goto-char (isearch-point-state (car isearch-cmds)))))