From unknown Thu Jun 19 13:56:37 2025 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.509 (Entity 5.509) Content-Type: text/plain; charset=utf-8 From: bug#14285 <14285@debbugs.gnu.org> To: bug#14285 <14285@debbugs.gnu.org> Subject: Status: 24.3; New octave feature: octave-update-function-file-comment Reply-To: bug#14285 <14285@debbugs.gnu.org> Date: Thu, 19 Jun 2025 20:56:37 +0000 retitle 14285 24.3; New octave feature: octave-update-function-file-comment reassign 14285 emacs submitter 14285 Leo Liu severity 14285 wishlist thanks From debbugs-submit-bounces@debbugs.gnu.org Sat Apr 27 04:15:02 2013 Received: (at submit) by debbugs.gnu.org; 27 Apr 2013 08:15:03 +0000 Received: from localhost ([127.0.0.1]:46004 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UW0Ha-0002Mk-Rv for submit@debbugs.gnu.org; Sat, 27 Apr 2013 04:15:01 -0400 Received: from eggs.gnu.org ([208.118.235.92]:35349) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UW0HT-0002MQ-75 for submit@debbugs.gnu.org; Sat, 27 Apr 2013 04:14:54 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UW0HM-0005Yn-Bm for submit@debbugs.gnu.org; Sat, 27 Apr 2013 04:14:45 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-101.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM, T_DKIM_INVALID,USER_IN_WHITELIST autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([208.118.235.17]:55235) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UW0HM-0005Yj-8T for submit@debbugs.gnu.org; Sat, 27 Apr 2013 04:14:44 -0400 Received: from eggs.gnu.org ([208.118.235.92]:46699) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UW0HK-0006kY-G2 for bug-gnu-emacs@gnu.org; Sat, 27 Apr 2013 04:14:44 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UW0HI-0005YJ-MX for bug-gnu-emacs@gnu.org; Sat, 27 Apr 2013 04:14:42 -0400 Received: from mail-pb0-x22c.google.com ([2607:f8b0:400e:c01::22c]:59303) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UW0HI-0005YA-Cs for bug-gnu-emacs@gnu.org; Sat, 27 Apr 2013 04:14:40 -0400 Received: by mail-pb0-f44.google.com with SMTP id wz17so1394157pbc.31 for ; Sat, 27 Apr 2013 01:14:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:from:to:subject:x-debbugs-cc:date:message-id :mime-version:content-type; bh=J0M/hSGbvrS3YnSnP3tK8G70HMUVuv6RxUzt+DCS8Eo=; b=A+fE/tAydyS+pd/X3OWbLskn47HVYzqd3WkHc4WlKPAmCjzBRZX0U1Y/XXW/A1xKPp DAukGgEzVhqzIfV93hGfBRpW0iJeFcnhopWwd/yAjau+MCcebEzictt/xYOYNxwPZfSp uf67zN39G3T0WAfT+6LIWd0/kUm4TNV84Qq+YHnaonELXYScz5bvAy31nMASLPSVZHlY 1j2cQ8AoEKzenrIknfwntFxaN9xCJN5i6AI0Vr1RluhhicpKD+vlm6fmavjYaodZssJr mYoSsPe8DshQbdQ2vJRg+OOuYm4ltwk9+qH3QEjVlQ1ZXpbZqCJFho5B3OwwAMNiUEDo BVdA== X-Received: by 10.66.248.40 with SMTP id yj8mr29772964pac.95.1367050479481; Sat, 27 Apr 2013 01:14:39 -0700 (PDT) Received: from Zeuss-MacBook.local ([110.172.225.137]) by mx.google.com with ESMTPSA id vb8sm15036247pbc.11.2013.04.27.01.14.37 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Sat, 27 Apr 2013 01:14:38 -0700 (PDT) From: Leo Liu To: bug-gnu-emacs@gnu.org Subject: 24.3; New octave feature: octave-update-function-file-comment X-Debbugs-CC: "Jordi =?iso-8859-1?Q?Guti=E9rrez?= Hermoso" , John Eaton , Stefan Monnier Date: Sat, 27 Apr 2013 16:14:26 +0800 Message-ID: MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 208.118.235.17 X-Spam-Score: -6.1 (------) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -6.1 (------) --=-=-= Content-Type: text/plain Hello Stefan, JordiGH and John, Based on our discussion on #octave and email, I have made a patch for review. For convenience octave.el with the patch applied is available from http://bpaste.net/raw/94528/. Note Emacs 24.3 is required. The new command octave-update-function-file-comment let users update the doc-string/doc-comment (per octave's definition) to the function name. I am only just beginning octave. So please help test and review the patch. Thanks. Leo --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=patch.diff Content-Description: patch.diff diff --git a/lisp/files.el b/lisp/files.el index 80166961..59eef757 100644 --- a/lisp/files.el +++ b/lisp/files.el @@ -4451,7 +4451,8 @@ (defvar auto-save-hook nil "Normal hook run just before auto-saving.") (defcustom before-save-hook nil - "Normal hook that is run before a buffer is saved to its file." + "Normal hook that is run before a buffer is saved to its file. +Any error from the hook prevents saving the buffer." :options '(copyright-update time-stamp) :type 'hook :group 'files) diff --git a/lisp/progmodes/octave.el b/lisp/progmodes/octave.el index f8b9e4f6..8a8a6616 100644 --- a/lisp/progmodes/octave.el +++ b/lisp/progmodes/octave.el @@ -32,6 +32,7 @@ ;; information on usage and customization. ;;; Code: +(eval-when-compile (require 'cl-lib)) (require 'comint) (defgroup octave nil @@ -1010,25 +1011,103 @@ (defun octave-maybe-insert-continuation-string () (delete-horizontal-space) (insert (concat " " octave-continuation-string)))) +(defun octave-function-file-p () + "Return non-nil if the first token is \"function\". +The value is (START END NAME-START NAME-END) of the function." + (save-excursion + (goto-char (point-min)) + (when (equal (funcall smie-forward-token-function) "function") + (forward-word -1) + (let* ((start (point)) + (end (progn (forward-sexp 1) (point))) + (name (when (progn + (goto-char start) + (re-search-forward octave-function-header-regexp + end t)) + (list (match-beginning 3) (match-end 3))))) + (cons start (cons end name)))))) + +;; Like forward-comment but stop at non-comment blank +(defun octave-skip-comment-forward (limit) + (and (comment-beginning) + (goto-char (comment-beginning))) + (goto-char (or (comment-search-forward limit t) (point))) + (while (and (< (point) limit) (looking-at-p "\\s<")) + (forward-comment 1))) + +;;; First non-copyright comment block +(defun octave-function-file-comment () + "Beginnning and end positions of the function file comment." + (save-excursion + (goto-char (point-min)) + (let ((bound (progn (forward-comment (point-max)) (point)))) + (goto-char (point-min)) + ;; Copyright block: octave/libinterp/parse-tree/lex.ll around line 1634 + (when (save-excursion + (comment-search-forward bound t) + (when (eq (char-after) ?\{) ; case of block comment + (forward-char 1)) + (skip-syntax-forward "-") + (let ((case-fold-search t)) + (looking-at-p "\\(?:copyright\\|author\\)\\_>"))) + (octave-skip-comment-forward bound)) + (let ((beg (comment-search-forward bound t))) + (when beg + (goto-char beg) + (octave-skip-comment-forward bound) + (list beg (point))))))) + (defun octave-sync-function-file-names () "Ensure function name agree with function file name. See Info node `(octave)Function Files'." (interactive) + (when buffer-file-name + (with-demoted-errors + (cl-destructuring-bind (&optional start _end name-start name-end) + (octave-function-file-p) + (when (and start name-start) + (let ((func (buffer-substring name-start name-end)) + (file (file-name-sans-extension + (file-name-nondirectory buffer-file-name)))) + (save-excursion + (when (and (not (equal file func)) + (progn + (goto-char name-start) + (yes-or-no-p + "Function name different from file name. Fix? "))) + (delete-region name-start name-end) + (insert file))))))))) + +(defun octave-update-function-file-comment (beg end &optional no-query) + "Update function file comment between BEG and END." + (interactive + (progn + (barf-if-buffer-read-only) + (if (use-region-p) + (list (region-beginning) (region-end) current-prefix-arg) + (append (or (octave-function-file-comment) + (error "No function file comment found")) + (list current-prefix-arg))))) (save-excursion - (when (and buffer-file-name - (prog2 - (goto-char (point-min)) - (equal (funcall smie-forward-token-function) "function") - (forward-word -1))) - (let ((file (file-name-sans-extension - (file-name-nondirectory buffer-file-name))) - (func (and (re-search-forward octave-function-header-regexp nil t) - (match-string 3)))) - (when (and func - (not (equal file func)) - (yes-or-no-p - "Function name different from file name. Fix? ")) - (replace-match file nil nil nil 3)))))) + (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 (and (re-search-forward "usage:\\|@deftypefn" end t) + (re-search-forward + "[=}]\\s-*\\(\\(?:\\sw\\|\\s_\\)+\\)\\s-*(" + (line-end-position) t)) + (match-string 1)))) + (old-func (read-string + (format (if old-func "From (default %s): " "From: ") + old-func) + nil nil old-func))) + (when (and func old-func (not (equal func old-func))) + (perform-replace old-func func + (not no-query) nil 'delimited nil nil beg end))))) ;;; Indentation @@ -1356,10 +1435,11 @@ (define-skeleton octave-insert-defun (t (concat vals " = "))) name args)) - \n "function " > str \n \n - octave-block-comment-start "usage: " str \n - octave-block-comment-start \n octave-block-comment-start - \n _ \n + \n octave-block-comment-start "usage: " str \n + octave-block-comment-start \n + octave-block-comment-start \n + "function " > str \n + _ \n "endfunction" > \n) ;;; Communication with the inferior Octave process --=-=-=-- From debbugs-submit-bounces@debbugs.gnu.org Sat Apr 27 09:19:38 2013 Received: (at 14285) by debbugs.gnu.org; 27 Apr 2013 13:19:38 +0000 Received: from localhost ([127.0.0.1]:46289 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UW52Q-0006sf-HD for submit@debbugs.gnu.org; Sat, 27 Apr 2013 09:19:38 -0400 Received: from ironport2-out.teksavvy.com ([206.248.154.182]:2375) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UW52P-0006sY-9y for 14285@debbugs.gnu.org; Sat, 27 Apr 2013 09:19:37 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Av4EABK/CFFFpYYW/2dsb2JhbABEvw4Xc4IfAQVWIxALDiYSFBgNJIgkwS2RCgOkeoFegxM X-IPAS-Result: Av4EABK/CFFFpYYW/2dsb2JhbABEvw4Xc4IfAQVWIxALDiYSFBgNJIgkwS2RCgOkeoFegxM X-IronPort-AV: E=Sophos;i="4.84,565,1355115600"; d="scan'208";a="8787127" Received: from 69-165-134-22.dsl.teksavvy.com (HELO pastel.home) ([69.165.134.22]) by ironport2-out.teksavvy.com with ESMTP/TLS/ADH-AES256-SHA; 27 Apr 2013 09:19:26 -0400 Received: by pastel.home (Postfix, from userid 20848) id 1FE7D67970; Sat, 27 Apr 2013 09:19:30 -0400 (EDT) From: Stefan Monnier To: Leo Liu Subject: Re: bug#14285: 24.3; New octave feature: octave-update-function-file-comment Message-ID: References: Date: Sat, 27 Apr 2013 09:19:30 -0400 In-Reply-To: (Leo Liu's message of "Sat, 27 Apr 2013 16:14:26 +0800") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -0.5 (/) X-Debbugs-Envelope-To: 14285 Cc: John Eaton , =?iso-8859-1?Q?Jordi_Guti=E9rrez_Hermoso?= , 14285@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -1.9 (-) [ FWIW, I use neither Octave nor Matlab and so I never use octave-mode. I just chose it as a kind of test for SMIE. So I don't have any opinion on the feature you suggest. ] > - "Normal hook that is run before a buffer is saved to its file." > + "Normal hook that is run before a buffer is saved to its file. > +Any error from the hook prevents saving the buffer." Maybe rather than fix the doc, we should fix the code and wrap the run-hook with a with-demote-errors? > + (cl-destructuring-bind (&optional start _end name-start name-end) > + (octave-function-file-p) I recommend you try (pcase-let ((`(,start ,_end ,name-start ,name-end) (octave-function-file-p))) instead. Stefan From debbugs-submit-bounces@debbugs.gnu.org Sat Apr 27 09:36:26 2013 Received: (at 14285) by debbugs.gnu.org; 27 Apr 2013 13:36:26 +0000 Received: from localhost ([127.0.0.1]:46300 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UW5Ic-0007i0-Uv for submit@debbugs.gnu.org; Sat, 27 Apr 2013 09:36:25 -0400 Received: from mail-pa0-f53.google.com ([209.85.220.53]:65185) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UW5IS-0007h7-35 for 14285@debbugs.gnu.org; Sat, 27 Apr 2013 09:36:17 -0400 Received: by mail-pa0-f53.google.com with SMTP id kx1so39051pab.26 for <14285@debbugs.gnu.org>; Sat, 27 Apr 2013 06:36:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:from:to:cc:subject:references:face:date:in-reply-to :message-id:user-agent:mime-version:content-type; bh=Rxyiz5w6j0pfLeVuI40671PQALjN5luCQh13dV/6oZE=; b=SCJGKZfoozZRQg6Ol9gg1WKhyVzhJIizvRz57nwAcIC2zJrO2tpkw2lyh/Fp/DLtaP j7kEyl91OsHEgIaIMCLxIw6dGSnaEF+EwBFcY/hy45RBK5iembKM9tqAhq1CyUqRNLic E2zK8wv9zDzIxoYztS6yW+fOmWmtsZloMxkbxfRRwdwuW2La8r34p+61o9HHwyHRIXwM 2f8ZmZ4W1E3R/DvhGbFIss3aGkR9xgeZixcKAQPnWeO2+/DdOjOXm4BxD8JqSQWxzpOo xQaA9j6fG5pa1SBRbZusXo+F6LOSaB/RUAdNiIg9eObjno2ZWBOAbEoNpVZy8iP5K6Je VzPQ== X-Received: by 10.68.218.34 with SMTP id pd2mr63115584pbc.204.1367069764978; Sat, 27 Apr 2013 06:36:04 -0700 (PDT) Received: from Zeuss-MacBook.local ([110.172.225.137]) by mx.google.com with ESMTPSA id v5sm4470814pbz.4.2013.04.27.06.36.01 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Sat, 27 Apr 2013 06:36:04 -0700 (PDT) From: Leo Liu To: Stefan Monnier Subject: Re: bug#14285: 24.3; New octave feature: octave-update-function-file-comment References: Face: iVBORw0KGgoAAAANSUhEUgAAACgAAAAoBAMAAAB+0KVeAAAAG1BMVEUAAAA9Cgm3Hx1WWFWA gn+WmJWsrqv4+vcCAwCRl2MkAAAAAXRSTlMAQObYZgAAAAFiS0dEAIgFHUgAAAAJcEhZcwAAAYoA AAGKATOXMFgAAAAHdElNRQfXAQwDNR+ZJmElAAABIklEQVQoz22SPW+DQAyGWUq65qasd9PNUSX4 AZHK2C1rJy5jpDS4IwRVup9dn7GNafpKIPPgzztXFSujqq1eM2n8h22oMkvxI/i9C97kRfMRUN55 dS3BrsAwBXUtMLAO4lryh8kTjOxKpQNniNxAgZOEe4bZwsDTFhKdqZRLNII4OQNHhEuq/RMkm6Cj TnnEA/fk0BorcYn5qA3oaeAxbaBOLrX+9G48NZ2Fzc2tzDM8Q+tMypEOqYHh8mAWaaK3U/cDMOT5 aMZMABgPXc7zPMs1A8DXO756GFJ/4fMEq47hTsAdn5avoxZ4ywl0c2w4Flu2Ybeyb3S+EqxX2DYA H8veJGEDTnHnrXvRaPyt+2kSfK6rfBZ2tUtfP/mR+pR6sX8BUZ/cDV7tvkoAAAAASUVORK5CYII= Date: Sat, 27 Apr 2013 21:35:57 +0800 In-Reply-To: (Stefan Monnier's message of "Sat, 27 Apr 2013 09:19:30 -0400") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (OS X 10.8.3) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -2.6 (--) X-Debbugs-Envelope-To: 14285 Cc: John Eaton , Jordi =?iso-8859-1?Q?Guti=E9rrez?= Hermoso , 14285@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.6 (--) Thank you, Stefan, for the comments. Patch updated. lisp/files.el | 3 +- lisp/progmodes/octave.el | 115 +++++++++++++++++++++++++++++++++++++++-------- 2 files changed, 99 insertions(+), 19 deletions(-) diff --git a/lisp/files.el b/lisp/files.el index 80166961..3af27bde 100644 --- a/lisp/files.el +++ b/lisp/files.el @@ -4540,7 +4540,8 @@ (defun basic-save-buffer () (insert ?\n)))) ;; Support VC version backups. (vc-before-save) - (run-hooks 'before-save-hook) + ;; Don't let errors prevent saving the buffer. + (with-demoted-errors (run-hooks 'before-save-hook)) (or (run-hook-with-args-until-success 'write-contents-functions) (run-hook-with-args-until-success 'local-write-file-hooks) (run-hook-with-args-until-success 'write-file-functions) diff --git a/lisp/progmodes/octave.el b/lisp/progmodes/octave.el index f8b9e4f6..ebdcb8b1 100644 --- a/lisp/progmodes/octave.el +++ b/lisp/progmodes/octave.el @@ -1010,25 +1010,103 @@ (defun octave-maybe-insert-continuation-string () (delete-horizontal-space) (insert (concat " " octave-continuation-string)))) +(defun octave-function-file-p () + "Return non-nil if the first token is \"function\". +The value is (START END NAME-START NAME-END) of the function." + (save-excursion + (goto-char (point-min)) + (when (equal (funcall smie-forward-token-function) "function") + (forward-word -1) + (let* ((start (point)) + (end (progn (forward-sexp 1) (point))) + (name (when (progn + (goto-char start) + (re-search-forward octave-function-header-regexp + end t)) + (list (match-beginning 3) (match-end 3))))) + (cons start (cons end name)))))) + +;; Like forward-comment but stop at non-comment blank +(defun octave-skip-comment-forward (limit) + (let ((ppss (syntax-ppss))) + (if (nth 4 ppss) + (goto-char (nth 8 ppss)) + (goto-char (or (comment-search-forward limit t) (point))))) + (while (and (< (point) limit) (looking-at-p "\\s<")) + (forward-comment 1))) + +;;; First non-copyright comment block +(defun octave-function-file-comment () + "Beginnning and end positions of the function file comment." + (save-excursion + (goto-char (point-min)) + (let ((bound (progn (forward-comment (point-max)) (point)))) + (goto-char (point-min)) + ;; Copyright block: octave/libinterp/parse-tree/lex.ll around line 1634 + (when (save-excursion + (comment-search-forward bound t) + (when (eq (char-after) ?\{) ; case of block comment + (forward-char 1)) + (skip-syntax-forward "-") + (let ((case-fold-search t)) + (looking-at-p "\\(?:copyright\\|author\\)\\_>"))) + (octave-skip-comment-forward bound)) + (let ((beg (comment-search-forward bound t))) + (when beg + (goto-char beg) + (octave-skip-comment-forward bound) + (list beg (point))))))) + (defun octave-sync-function-file-names () "Ensure function name agree with function file name. See Info node `(octave)Function Files'." (interactive) + (when buffer-file-name + (pcase-let ((`(,start ,_end ,name-start ,name-end) + (octave-function-file-p))) + (when (and start name-start) + (let ((func (buffer-substring name-start name-end)) + (file (file-name-sans-extension + (file-name-nondirectory buffer-file-name)))) + (save-excursion + (when (and (not (equal file func)) + (progn + (goto-char name-start) + (yes-or-no-p + "Function name different from file name. Fix? "))) + (delete-region name-start name-end) + (insert file)))))))) + +(defun octave-update-function-file-comment (beg end &optional no-query) + "Update function file comment between BEG and END." + (interactive + (progn + (barf-if-buffer-read-only) + (if (use-region-p) + (list (region-beginning) (region-end) current-prefix-arg) + (append (or (octave-function-file-comment) + (error "No function file comment found")) + (list current-prefix-arg))))) (save-excursion - (when (and buffer-file-name - (prog2 - (goto-char (point-min)) - (equal (funcall smie-forward-token-function) "function") - (forward-word -1))) - (let ((file (file-name-sans-extension - (file-name-nondirectory buffer-file-name))) - (func (and (re-search-forward octave-function-header-regexp nil t) - (match-string 3)))) - (when (and func - (not (equal file func)) - (yes-or-no-p - "Function name different from file name. Fix? ")) - (replace-match file nil nil nil 3)))))) + (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 (and (re-search-forward "usage:\\|@deftypefn" end t) + (re-search-forward + "[=}]\\s-*\\(\\(?:\\sw\\|\\s_\\)+\\)\\s-*(" + (line-end-position) t)) + (match-string 1)))) + (old-func (read-string + (format (if old-func "From (default %s): " "From: ") + old-func) + nil nil old-func))) + (when (and func old-func (not (equal func old-func))) + (perform-replace old-func func + (not no-query) nil 'delimited nil nil beg end))))) ;;; Indentation @@ -1356,10 +1434,11 @@ (define-skeleton octave-insert-defun (t (concat vals " = "))) name args)) - \n "function " > str \n \n - octave-block-comment-start "usage: " str \n - octave-block-comment-start \n octave-block-comment-start - \n _ \n + \n octave-block-comment-start "usage: " str \n + octave-block-comment-start \n + octave-block-comment-start \n + "function " > str \n + _ \n "endfunction" > \n) ;;; Communication with the inferior Octave process -- 1.8.2 From debbugs-submit-bounces@debbugs.gnu.org Sat Apr 27 13:50:30 2013 Received: (at 14285) by debbugs.gnu.org; 27 Apr 2013 17:50:30 +0000 Received: from localhost ([127.0.0.1]:47238 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UW9GX-0000aB-NK for submit@debbugs.gnu.org; Sat, 27 Apr 2013 13:50:30 -0400 Received: from mail-pb0-f41.google.com ([209.85.160.41]:46753) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UW9GV-0000a3-Op for 14285@debbugs.gnu.org; Sat, 27 Apr 2013 13:50:28 -0400 Received: by mail-pb0-f41.google.com with SMTP id md12so1212842pbc.14 for <14285@debbugs.gnu.org>; Sat, 27 Apr 2013 10:50:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:from:to:cc:subject:references:face:date:in-reply-to :message-id:user-agent:mime-version:content-type; bh=kLVY9s7zugELLVd16sEZIDSMaTkgWRtm63oEpccQbIA=; b=jWqsQSQeKn86ghj/tTARzGMOAzz+uBywJBHUkGG9kbinfYIcmGLJn3COaBXUS9IL0g a/WSo4kke5ncsGcYAB+ynzJ2P2Z3bjWUcSZLswLzYV+RiM56eep89u0w4hIW87dJiw/y eFgHJjvAQue9eIxd0K4YJZru6zRBZVS3kIL9Q8HvPVwZpoCfzKidO9vKQtH1CAMBbpzq 6UsDN+0lzSwN+d5asn4qrsVUrmys9d3fv5iJa3Z79i1QEQ8WfhF2Y0LZSiL5U5r7TJQT E3z6eNgxwGkJuIUaGy7xMRNnMeOS8vXTvicXi3tv8wlhnL+VLVS0pv5X15uem9DQKlOw TYpQ== X-Received: by 10.66.122.8 with SMTP id lo8mr36168084pab.163.1367085019566; Sat, 27 Apr 2013 10:50:19 -0700 (PDT) Received: from localhost ([110.172.225.137]) by mx.google.com with ESMTPSA id dg5sm16688963pbc.29.2013.04.27.10.50.17 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Sat, 27 Apr 2013 10:50:18 -0700 (PDT) From: Leo Liu To: 14285@debbugs.gnu.org Subject: Re: bug#14285: 24.3; New octave feature: octave-update-function-file-comment References: Face: iVBORw0KGgoAAAANSUhEUgAAACgAAAAoAgMAAADxkFD+AAAADFBMVEUvT09qWs3/pQD///+J kUVcAAAAAWJLR0QAiAUdSAAAAAlwSFlzAAALEwAACxMBAJqcGAAAAAd0SU1FB9cBBwMLOd3veKQA AACuSURBVBjTldE9CgIxEAXgB+lEyFUC2wo5ikdZ8DSypxhMY7H9VuIVwlqkGRgnm59VsHGafIQ3 CZlAtmKIRaHETgYa12lqvEsPYKf8wXHsPGfqPaUM0g9aJPKFXkmNQmSDqwzz4Fpgpz+6WAPY2z5o uPJJpu0uypcl4nyCibMLQ8lCiVjayLoQvw5LsVKQuHPRR958HZbOcVsKeepcLxpByjycGvnKmY+c MBvrtyjfe0vmuLvdq/kAAAAASUVORK5CYII= Date: Sun, 28 Apr 2013 01:50:11 +0800 In-Reply-To: (Leo Liu's message of "Sat, 27 Apr 2013 21:35:57 +0800") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (OS X 10.8.3) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -2.6 (--) X-Debbugs-Envelope-To: 14285 Cc: John Eaton , Jordi =?iso-8859-1?Q?Guti=E9rrez?= Hermoso X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.6 (--) Installed in trunk. I'll leave this bug open for a few more days. From debbugs-submit-bounces@debbugs.gnu.org Thu May 02 03:20:53 2013 Received: (at 14285-done) by debbugs.gnu.org; 2 May 2013 07:20:53 +0000 Received: from localhost ([127.0.0.1]:54386 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UXnox-0007Xi-O7 for submit@debbugs.gnu.org; Thu, 02 May 2013 03:20:52 -0400 Received: from mail-pd0-f177.google.com ([209.85.192.177]:54384) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UXnou-0007XQ-UT for 14285-done@debbugs.gnu.org; Thu, 02 May 2013 03:20:49 -0400 Received: by mail-pd0-f177.google.com with SMTP id g10so202684pdj.36 for <14285-done@debbugs.gnu.org>; Thu, 02 May 2013 00:20:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:from:to:subject:references:face:date:in-reply-to :message-id:user-agent:mime-version:content-type; bh=CIMznDFkaRhbkBs7b3WlzyozusX3QJv7I6Eowbglq34=; b=Nr+MwKn3TRE+VHSJvLlqZarfduSX+IyMcdpj4Pvutp9Hf7UF/JsQx/xVSORQXeJ4LZ u4jP8O5zaSBqTXeqJVvMlaeq5Dy+FaYUXb0DxH/2Lwa+taVZGepByOJIK89ImrbZCPGK U41BnE0SWkKdsOve6L8/gnzcCnIm7lU43PXWP98NrnV2/7Cb8UkzTmGFFGbb3hzgLHI1 KXBaklIrG27GDNvEDxnO2rhVrt43gNB0yJ8rIK0/cwsUese6gXO/PqX3Kup2GyWddlOq 6DzUa1Ie8dIDRDMzcmZ6/OeKVpbC25R12N+ikftrFDXFVemnYfl3m7jogIvw1dueBywC WXsg== X-Received: by 10.68.114.37 with SMTP id jd5mr7565491pbb.95.1367479214797; Thu, 02 May 2013 00:20:14 -0700 (PDT) Received: from Zeuss-MacBook.local ([110.172.225.137]) by mx.google.com with ESMTPSA id gc5sm6250129pbb.19.2013.05.02.00.20.12 for <14285-done@debbugs.gnu.org> (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Thu, 02 May 2013 00:20:14 -0700 (PDT) From: Leo Liu To: 14285-done@debbugs.gnu.org Subject: Re: bug#14285: 24.3; New octave feature: octave-update-function-file-comment References: Face: iVBORw0KGgoAAAANSUhEUgAAACgAAAAoBAMAAAB+0KVeAAAAG1BMVEUAAAA9Cgm3Hx1WWFWA gn+WmJWsrqv4+vcCAwCRl2MkAAAAAXRSTlMAQObYZgAAAAFiS0dEAIgFHUgAAAAJcEhZcwAAAYoA AAGKATOXMFgAAAAHdElNRQfXAQwDNR+ZJmElAAABIklEQVQoz22SPW+DQAyGWUq65qasd9PNUSX4 AZHK2C1rJy5jpDS4IwRVup9dn7GNafpKIPPgzztXFSujqq1eM2n8h22oMkvxI/i9C97kRfMRUN55 dS3BrsAwBXUtMLAO4lryh8kTjOxKpQNniNxAgZOEe4bZwsDTFhKdqZRLNII4OQNHhEuq/RMkm6Cj TnnEA/fk0BorcYn5qA3oaeAxbaBOLrX+9G48NZ2Fzc2tzDM8Q+tMypEOqYHh8mAWaaK3U/cDMOT5 aMZMABgPXc7zPMs1A8DXO756GFJ/4fMEq47hTsAdn5avoxZ4ywl0c2w4Flu2Ybeyb3S+EqxX2DYA H8veJGEDTnHnrXvRaPyt+2kSfK6rfBZ2tUtfP/mR+pR6sX8BUZ/cDV7tvkoAAAAASUVORK5CYII= Date: Thu, 02 May 2013 15:20:07 +0800 In-Reply-To: (Leo Liu's message of "Sun, 28 Apr 2013 01:50:11 +0800") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (OS X 10.8.3) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 14285-done X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -1.9 (-) Fixed in trunk. From unknown Thu Jun 19 13:56:37 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Thu, 30 May 2013 11:24:03 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator