Gnus development mailing list
 help / color / mirror / Atom feed
From: Reiner Steib <4.uce.03.r.s@nurfuerspam.de>
Subject: Re: A lot of questions concerning `gnus-score-edit-file-at-point'
Date: Mon, 29 Dec 2003 22:15:05 +0100	[thread overview]
Message-ID: <v9ad5buy06.fsf@marauder.physik.uni-ulm.de> (raw)
In-Reply-To: <m3zndbpgq7.fsf@hamster.pflaesterer.de>

On Mon, Dec 29 2003, Karl Pflästerer wrote:

> That raises another question: is the `(setq truncate-lines t)' really
> necessary?  I don't see a reason and I don't like it at all.

Maybe `truncate-lines' has been used because most of the time people
are more interested in the rule than in the file name.  I also use
<end> quite often in this buffer to see the filename.  Most of the
time I only see the directory.

But we can make the *Score Trace* buffer more readable with
`truncate-lines': We can use `abbreviate-file-name' on the full file
name and also print the file name (without directory and extension).
It could look like this:

("@my-fqdn>$" 10000 nil r) [my-posts] ->  ~/News/score/topics/my-posts.SCORE

Instead of "[", "]" and " -> ", we can use other delimiters: Whatever
fits well in the new `gnus-score-edit-file-at-point' code and is more
or clear for the user.

Additionally, I'd like to add some kind of "Quick help", telling the
user about useful key bindings in that buffer (and maybe explain the
output lines above).  See the patch below[1].  Opinions?

> (defun gnus-score-edit-file-at-point ()
>   "Edit score file at point.  Useful especially after `V t'."
[...]
>     (if (or (string-match "non-file" file) (not file) (string= "" file))

Shouldn't this read...

      (if (or (not file) (string-match "non-file" file) (string= "" file))

If file is nil, `string-match' will error out otherwise.

Bye, Reiner.


--8<---------------cut here---------------start------------->8---
--- gnus-score.el	22 Dec 2003 11:39:05 -0000	6.38
+++ gnus-score.el	29 Dec 2003 20:54:48 -0000
@@ -2354,7 +2365,8 @@
     (let ((gnus-newsgroup-headers
 	   (list (gnus-summary-article-header)))
 	  (gnus-newsgroup-scored nil)
-	  trace)
+	  trace
+	  file)
       (save-excursion
 	(nnheader-set-temp-buffer "*Score Trace*"))
       (setq gnus-score-trace nil)
@@ -2370,12 +2382,26 @@
 			 (interactive)
 			 (bury-buffer nil)
 			 (gnus-summary-expand-window)))
-	(local-set-key "e" 'gnus-score-edit-file-at-point)
+	(local-set-key "e" (lambda ()
+			     "Run `gnus-score-edit-file-at-point'."
+			     (interactive)
+			     (gnus-score-edit-file-at-point)))
 	(setq truncate-lines t)
 	(while trace
-	  (insert (format "%S  ->  %s\n" (cdar trace)
-			  (or (caar trace) "(non-file rule)")))
+	  (setq file (or (caar trace)
+			 "(non-file rule)"))
+	  (insert (format "%S [%s] -> %s\n"
+			  ;; sync with `gnus-score-edit-file-at-point'
+			  (cdar trace)
+			  (file-name-sans-extension
+			   (file-name-nondirectory file))
+			  (abbreviate-file-name file)))
 	  (setq trace (cdr trace)))
+	(insert
+	 "\n\nQuick help:
+
+  q - quit
+  e - edit score file entry")
 	(goto-char (point-min))
 	(gnus-configure-windows 'score-trace)))
     (set-buffer gnus-summary-buffer)
--8<---------------cut here---------------end--------------->8---
-- 
       ,,,
      (o o)
---ooO-(_)-Ooo--- PGP key available via WWW   http://rsteib.home.pages.de/




  reply	other threads:[~2003-12-29 21:15 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-12-28 17:45 Karl Pflästerer
2003-12-29 17:15 ` Reiner Steib
2003-12-29 19:59   ` Karl Pflästerer
2003-12-29 21:15     ` Reiner Steib [this message]
2003-12-29 23:10       ` Karl Pflästerer
2003-12-30 13:40         ` Reiner Steib
2003-12-30 17:30           ` Karl Pflästerer
2003-12-30 20:58             ` Reiner Steib
2003-12-30 21:17               ` Karl Pflästerer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=v9ad5buy06.fsf@marauder.physik.uni-ulm.de \
    --to=4.uce.03.r.s@nurfuerspam.de \
    --cc=reiner.steib@gmx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).