From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: martin rudalics Newsgroups: gmane.emacs.devel Subject: Re: [Emacs-diffs] Changes to emacs/lisp/bookmark.el,v Date: Sun, 23 Nov 2008 20:11:45 +0100 Message-ID: <4929AAF1.7060109@gmx.at> References: <87y6zggnmz.fsf@red-bean.com> <87abbt8wpm.fsf@red-bean.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------010903090407030704020102" X-Trace: ger.gmane.org 1227467700 17456 80.91.229.12 (23 Nov 2008 19:15:00 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 23 Nov 2008 19:15:00 +0000 (UTC) Cc: Karl Fogel , schwab@suse.de, cyd@stupidchicken.com, miles@gnu.org, emacs-devel@gnu.org To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun Nov 23 20:16:03 2008 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1L4KR8-0004J5-BJ for ged-emacs-devel@m.gmane.org; Sun, 23 Nov 2008 20:16:03 +0100 Original-Received: from localhost ([127.0.0.1]:54732 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1L4KPy-0006I1-Pq for ged-emacs-devel@m.gmane.org; Sun, 23 Nov 2008 14:14:50 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1L4KPv-0006Hw-DS for emacs-devel@gnu.org; Sun, 23 Nov 2008 14:14:47 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1L4KPu-0006Hk-Rt for emacs-devel@gnu.org; Sun, 23 Nov 2008 14:14:47 -0500 Original-Received: from [199.232.76.173] (port=37542 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1L4KPu-0006Hh-Oy for emacs-devel@gnu.org; Sun, 23 Nov 2008 14:14:46 -0500 Original-Received: from mail.gmx.net ([213.165.64.20]:41093) by monty-python.gnu.org with smtp (Exim 4.60) (envelope-from ) id 1L4KPt-0000aQ-Mk for emacs-devel@gnu.org; Sun, 23 Nov 2008 14:14:46 -0500 Original-Received: (qmail invoked by alias); 23 Nov 2008 19:14:40 -0000 Original-Received: from 88-117-41-136.adsl.highway.telekom.at (EHLO [88.117.41.136]) [88.117.41.136] by mail.gmx.net (mp023) with SMTP; 23 Nov 2008 20:14:40 +0100 X-Authenticated: #14592706 X-Provags-ID: V01U2FsdGVkX1+jxJls//+jyBIvIBgQz9pJWxdkbWxuTyLTL0/jbq K8ae7yEfvSFOPI User-Agent: Thunderbird 2.0.0.16 (Windows/20080708) In-Reply-To: X-Y-GMX-Trusted: 0 X-FuHaFi: 0.71,0.5 X-detected-operating-system: by monty-python.gnu.org: Genre and OS details not recognized. X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:106043 Archived-At: This is a multi-part message in MIME format. --------------010903090407030704020102 Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 7bit > That's the whole point: if several files are committed in one go, the > log message for each file will be usually taken from several ChangeLog > entries, sometimes from several different directories (e.g., if C > files and Lisp files are modified together, or if the documentation is > changed as well). Then "cvs log FILENAME" will show a huge pile of > different entries for each FILENAME in the changeset. What I want is > an option to "cvs log" that will show only the entries of the one file > I'm interested in. CVS doesn't record that information, so I'm down > to grepping "cvs log" output, which is unreliable because I don't > always know what I'm looking for, and because of inconsistencies in > how the ChangeLog entries are formatted. How about something in the direction of the attached patch? martin --------------010903090407030704020102 Content-Type: text/plain; name="log-view.diff" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="log-view.diff" *** log-view.el.~1.55.~ 2008-06-16 11:28:44.000000000 +0200 --- log-view.el 2008-11-23 20:06:16.218750000 +0100 *************** *** 137,142 **** --- 137,145 ---- ([backtab] . log-view-msg-prev) ("N" . log-view-file-next) ("P" . log-view-file-prev) + ("o" . log-view-show-object-only) + ("c" . log-view-show-current-only) + ("y" . log-view-show-any) ("\M-n" . log-view-file-next) ("\M-p" . log-view-file-prev)) "Log-View's keymap." *************** *** 171,177 **** ["Next File" log-view-file-next :help "Go to the next count'th file"] ["Previous File" log-view-file-prev ! :help "Go to the previous count'th file"])) (defvar log-view-mode-hook nil "Hook run at the end of `log-view-mode'.") --- 174,187 ---- ["Next File" log-view-file-next :help "Go to the next count'th file"] ["Previous File" log-view-file-prev ! :help "Go to the previous count'th file"] ! "-----" ! ["Show Object Only" log-view-show-object-only ! :help "Show entries for object at point only"] ! ["Show Current Only" log-view-show-current-only ! :help "Show entries for current file only"] ! ["Show Any" log-view-show-any ! :help "Show any entry"])) (defvar log-view-mode-hook nil "Hook run at the end of `log-view-mode'.") *************** *** 532,537 **** --- 542,673 ---- (list log-view-vc-backend nil) to fr))) + + (defun log-view-hide (from to) + "Hide text within FROM and TO." + (when (< from to) + (put-text-property from to 'invisible t))) + + (defun log-view-show-any () + "Show any entry. + Show any entry hidden by a previous `log-view-show-object-only' + or `log-view-show-current-only' command." + (interactive) + (let ((inhibit-read-only t)) + (remove-text-properties (point-min) (point-max) '(invisible nil)))) + + (defun log-view-object-at-point () + "Return name of object at point. + The object at point must be a name preceded by a left paren or a + comma and followed by a right paren or a comma." + (save-excursion + (save-restriction + (narrow-to-region (line-beginning-position) (line-end-position)) + (let ((from (save-excursion + (when (re-search-backward ",[ ]+\\|(" nil t) + (match-end 0)))) + (to (save-excursion + (when (re-search-forward ",\\|)" nil t) + (match-beginning 0))))) + (when (and from to) + (buffer-substring-no-properties from to)))))) + + (defun log-view-show-object-only () + "Show log entries for object at point only." + (interactive) + (let* ((name (log-view-object-at-point)) + (name-rq (when name (regexp-quote name))) + (inhibit-read-only t) + from to) + (unless name + (error "No fun round point")) + ;; Avoid to get the same object for another file. + (log-view-show-current-only) + (save-excursion + (save-restriction + (widen) + (goto-char (point-min)) + (setq from (when (re-search-forward log-view-message-re nil t) + (line-beginning-position))) + (while (< from (point-max)) + (setq to (if (re-search-forward log-view-message-re nil t) + (line-beginning-position) + (point-max))) + (save-excursion + (goto-char from) + (unless (and (re-search-forward name-rq to t) + (string-equal name (log-view-object-at-point))) + (log-view-hide from to))) + (setq from to) + (goto-char to) + (forward-line)))))) + + (defconst log-view-show-entry-re "^[ \t\n]*\\*[ \t]+") + + (defun log-view-show-current-only () + "Show log entries for current file only." + (interactive) + (log-view-show-any) + (let* ((name (file-name-nondirectory (log-view-current-file))) + (name-rq (when name (regexp-quote name))) + (name-re + (when name (concat ".*" name-rq))) + (log-view-show-entry-and-name-re + (when name + (concat log-view-show-entry-re ".*" name-rq))) + (inhibit-read-only t) + from to) + (unless name + (error "Couldn't find file name")) + (save-excursion + (save-restriction + (widen) + (goto-char (point-min)) + (while (< (setq from + (if (re-search-forward log-view-message-re nil 'move) + (line-beginning-position 2) + (point-max))) + (point-max)) + (setq to (if (re-search-forward log-view-message-re nil t) + (line-beginning-position 0) + (point-max))) + (goto-char from) + (let ((before-from (line-beginning-position)) + before-to after-from within-from within-to) + (while (re-search-forward log-view-show-entry-re to t) + (if (looking-at name-re) + ;; Relevant entry. + (setq before-to before-from) + ;; Irrelevant entry. + (setq before-to + (if (re-search-forward + log-view-show-entry-and-name-re to 'move) + (line-beginning-position) + to))) + (log-view-hide before-from before-to) + (setq after-from + (if (re-search-forward log-view-show-entry-re to 'move) + (line-beginning-position) + to)) + (when (< before-to after-from) + (goto-char before-to) + ;; Handle the special case where a common ChangeLog text + ;; is written for entries from different files. + (when (and (re-search-forward ":[ \t\n]+" after-from t) + (setq within-from (match-beginning 0)) + (looking-at log-view-show-entry-re) + (re-search-forward ":[ \t\n]+[^*]" to t) + (setq within-to (match-beginning 0))) + (log-view-hide within-from within-to) + (setq after-from + (if (re-search-forward log-view-show-entry-re to 'move) + (line-beginning-position) + to)))) + (goto-char (setq before-from after-from))) + (when after-from + (log-view-hide after-from to))) + (goto-char to)))))) + (provide 'log-view) ;; arch-tag: 0d64220b-ce7e-4f62-9c2a-6b04c2f81f4f --------------010903090407030704020102--