Function: log-edit-comment-search-backward

log-edit-comment-search-backward is an interactive and byte-compiled function defined in log-edit.el.gz.

Signature

(log-edit-comment-search-backward STR &optional STRIDE)

Documentation

Search backwards through VC commit comment history for a match of STR.

If the optional argument STRIDE is present, that is a step-width to use when going through the comment ring, log-edit-comment-ring.

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/vc/log-edit.el.gz
(defun log-edit-comment-search-backward (str &optional stride)
  "Search backwards through VC commit comment history for a match of STR.
If the optional argument STRIDE is present, that is a step-width to use
when going through the comment ring, `log-edit-comment-ring'."
  ;; Why substring rather than regexp ?   -sm
  (interactive
   (list (read-string (format-prompt "Comment substring"
                                     log-edit-last-comment-match)
                      nil nil log-edit-last-comment-match)))
  (unless stride (setq stride 1))
  (if (string= str "")
      (setq str log-edit-last-comment-match)
    (setq log-edit-last-comment-match str))
  (let* ((str (regexp-quote str))
	 (len (ring-length log-edit-comment-ring))
	 (n (log-edit-new-comment-index stride len)))
    (while (progn (when (or (>= n len) (< n 0)) (error "Not found"))
		  (not (string-match str (ring-ref log-edit-comment-ring n))))
      (setq n (+ n stride)))
    (setq log-edit-comment-ring-index n)
    (log-edit-previous-comment 0)))