Function: octave-update-function-file-comment

octave-update-function-file-comment is an interactive and byte-compiled function defined in octave.el.gz.

Signature

(octave-update-function-file-comment BEG END)

Documentation

Query replace function names in function file comment.

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/progmodes/octave.el.gz
(defun octave-update-function-file-comment (beg end)
  "Query replace function names in function file comment."
  (interactive
   (progn
     (barf-if-buffer-read-only)
     (if (use-region-p)
         (list (region-beginning) (region-end))
       (or (octave-function-file-comment)
           (error "No function file comment found")))))
  (save-excursion
    (let* ((bounds (or (octave-function-file-p)
                       (error "Not in a function file buffer")))
           (func (if (cddr bounds)
                     (apply #'buffer-substring (cddr bounds))
                   (error "Function name not found")))
           (old-func (progn
                       (goto-char beg)
                       (when (re-search-forward
                              "[=}]\\s-*\\(\\(?:\\sw\\|\\s_\\)+\\)\\_>"
                              (min (line-end-position 4) end)
                              t)
                         (match-string 1))))
           (old-func (read-string (format-prompt "Name to replace" old-func)
                                  nil nil old-func)))
      (if (and func old-func (not (equal func old-func)))
          (perform-replace old-func func 'query
                           nil 'delimited nil nil beg end)
        (message "Function names match")))))