From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: "Alfred M. Szmidt" Newsgroups: gmane.emacs.devel Subject: vc-modify-change-comment for "modern" backend fix Date: Tue, 17 May 2022 03:04:53 -0400 Message-ID: Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="16895"; mail-complaints-to="usenet@ciao.gmane.io" To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Tue May 17 09:08:14 2022 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nqrJW-0004EK-9U for ged-emacs-devel@m.gmane-mx.org; Tue, 17 May 2022 09:08:14 +0200 Original-Received: from localhost ([::1]:44834 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nqrJU-0005d1-Kw for ged-emacs-devel@m.gmane-mx.org; Tue, 17 May 2022 03:08:12 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:36440) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nqrGH-0004db-Lw for emacs-devel@gnu.org; Tue, 17 May 2022 03:04:53 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:53674) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nqrGH-0004Bf-Db for emacs-devel@gnu.org; Tue, 17 May 2022 03:04:53 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=Date:Subject:To:From:mime-version:in-reply-to: references; bh=UsE0U+FsJB7BI9KsUTZiMQ8YSuFnmtS+4B6BbEsVN50=; b=db/lZeknSlm8JI ItPecvclUMIBSdGlNYZd2HkuA+0fWsyPOLfmAPySCOtVoOSGntsgdgYQErCaedbc9jueAmISRnGCD saHYKUEDhQw5QbZ4T4FdKQBLC1SviADKoib31LS4w1P/6PWUiofF3TVbqGHXtEFNPo9sID/fvFAUt 3swr80ATHts4zBUusIj6He4CyHeNVCqFjWT/QwBNEXOQKYK+monWwbLimgPuamN1F05dQeXmP09xM Ex/JvT7MP1QTxw7t5zJpQ7hZqzUADdGdp83Zr5OTipXRQfjO4tKWTiyUp5F3/iB+HRh9rOmOPwAO7 4MD2q8or7oUn7ev7E/cA==; Original-Received: from ams by fencepost.gnu.org with local (Exim 4.90_1) (envelope-from ) id 1nqrGH-0007Mj-2O for emacs-devel@gnu.org; Tue, 17 May 2022 03:04:53 -0400 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:289830 Archived-At: I'm trying to add vc-modify-change-comment functionality to vc-fossil, but running into a small issue in log-view.el, namley the following mentioned in vc.el: ;; - Second, `log-view-modify-change-comment' doesn't seem to support ;; modern backends at all because `log-view-extract-comment' ;; unconditionally calls `log-view-current-file'. This should be easy to ;; fix. There are two ways to fix it, one is to just check if log-view-per-file-logs is set before calling log-view-extract-comment, or simply make sure that log-view-current-file behaves. Attached two patches, the first modifies all calleers and log-view-current-file, the second just log-view-extract-comment. I think the first one is preferable... Thoughts? diff --git a/lisp/vc/log-view.el b/lisp/vc/log-view.el index 415b1564ed..791ef66c92 100644 --- a/lisp/vc/log-view.el +++ b/lisp/vc/log-view.el @@ -282,22 +282,24 @@ log-view-dir-re (defun log-view-current-file () "Return the current file." - (save-excursion - (forward-line 1) - (or (re-search-backward log-view-file-re nil t) - (re-search-forward log-view-file-re nil t) - (error "Unable to determine the current file")) - (let* ((file (match-string 1)) - (cvsdir (and (re-search-backward log-view-dir-re nil t) - (match-string 1))) - (pcldir (and (boundp 'cvs-pcl-cvs-dirchange-re) - (re-search-backward cvs-pcl-cvs-dirchange-re nil t) - (match-string 1))) - (dir "")) - (let ((default-directory "")) - (when pcldir (setq dir (expand-file-name pcldir dir))) - (when cvsdir (setq dir (expand-file-name cvsdir dir)))) - (expand-file-name file dir)))) + (if log-view-per-file-logs + (save-excursion + (forward-line 1) + (or (re-search-backward log-view-file-re nil t) + (re-search-forward log-view-file-re nil t) + (error "Unable to determine the current file")) + (let* ((file (match-string 1)) + (cvsdir (and (re-search-backward log-view-dir-re nil t) + (match-string 1))) + (pcldir (and (boundp 'cvs-pcl-cvs-dirchange-re) + (re-search-backward cvs-pcl-cvs-dirchange-re nil t) + (match-string 1))) + (dir "")) + (let ((default-directory "")) + (when pcldir (setq dir (expand-file-name pcldir dir))) + (when cvsdir (setq dir (expand-file-name cvsdir dir)))) + (expand-file-name file dir))) + (car log-view-vc-fileset))) (defun log-view-current-entry (&optional pos move) "Return the position and revision tag of the Log View entry at POS. @@ -512,9 +514,7 @@ log-view-find-revision (user-error "Multiple files shown in this buffer, cannot use this command here"))) (save-excursion (goto-char pos) - (switch-to-buffer (vc-find-revision (if log-view-per-file-logs - (log-view-current-file) - (car log-view-vc-fileset)) + (switch-to-buffer (vc-find-revision (log-view-current-file) (log-view-current-tag))))) @@ -541,9 +541,7 @@ log-view-extract-comment (defun log-view-modify-change-comment () "Edit the change comment displayed at point." (interactive) - (vc-modify-change-comment (list (if log-view-per-file-logs - (log-view-current-file) - (car log-view-vc-fileset))) + (vc-modify-change-comment (list (log-view-current-file)) (log-view-current-tag) (log-view-extract-comment))) @@ -558,9 +556,7 @@ log-view-annotate-version (user-error "Multiple files shown in this buffer, cannot use this command here"))) (save-excursion (goto-char pos) - (vc-annotate (if log-view-per-file-logs - (log-view-current-file) - (car log-view-vc-fileset)) + (vc-annotate (log-view-current-file) (log-view-current-tag)))) ;; @@ -620,9 +616,7 @@ log-view-diff-common ;; diff for all the files in the changeset, pass NIL for ;; the file list. (unless whole-changeset - (if log-view-per-file-logs - (list (log-view-current-file)) - log-view-vc-fileset))) + (list (log-view-current-file)))) fr to))) (provide 'log-view) diff --git a/lisp/vc/log-view.el b/lisp/vc/log-view.el index 415b1564ed..83557402fc 100644 --- a/lisp/vc/log-view.el +++ b/lisp/vc/log-view.el @@ -521,7 +521,10 @@ log-view-find-revision (defun log-view-extract-comment () "Parse comment from around the current point in the log." (save-excursion - (let (st en (backend (vc-backend (log-view-current-file)))) + (let (st en (backend (vc-backend + (if log-view-per-file-logs + (log-view-current-file) + (car log-view-vc-fileset))))) (log-view-end-of-defun) (cond ((eq backend 'SVN) (forward-line -1)))