Article View: news.software.readers
Article #35408Save file names (Was: Re: SLRN Wishlist [970722])
From: Jan Hlavacek
Date: Tue, 22 Jul 1997 00:00
Date: Tue, 22 Jul 1997 00:00
91 lines
3682 bytes
3682 bytes
On 21 Jul 1997 22:27:44 GMT, Sven Guckes <guckes@math.fu-berlin.de> wrote:
> Default Save File for Newsgroups
> When saving an article to a file then the filename you are
> presented with is "~/News/Newsgroup.name". JED: "Later you will
> be able to define what file to use for a given newsgroup."
> [960506]
> Status: "todo"
This is what I use (edit the get_file_for_group function)
% this is based on the following macro posted by J.B. Nicholson-Owens
% (<jbn@pop-a-wheelie.midwest.net>)
define append_article_save (file)
{
% Saves the current article to the named file, appending if the file
% exists.
if (is_group_mode) return (); % this only works in article mode
set_input_string (file); % put filename in the response stack
call ("save"); % save article (into file)
}
define complete_filename (file)
{
% Append the name of the file to ${HOME}/News/
% unless it starts with ~ or /
if ((file[0] == '~') or (file[0] == '/')) return (file);
Sprintf ("%s/%s/%s", getenv("HOME"),
get_variable_value("save_directory"),
file, 3);
}
define get_file_for_group (group)
{
% Assign a name of an output folder based on the group name.
% I don't like to have all those really long file names.
% If the group isn't on the list, leave it the way it is.
switch (group)
{case "soc.culture.czecho-slovak" : "sccs"}
{case "news.software.readers" : "newsreaders"}
{case "comp.editors" : "editors"}
{case "comp.infosystems.www.authoring.html" : "ciwah"}
{case "comp.text.sgml" : "sgml"}
{pop (); group}
return ();
}
define my_save ()
{
% Saves article into a folder based on some criteria.
% Offers the folder name to edit.
if (is_group_mode) return ();
variable group = current_newsgroup;
variable subject = strlow(extract_article_header ("Subject"));
% First, pick a folder name based on group.
variable file = get_file_for_group (group);
% Then treat some special subjects separately.
if (is_substr (subject, "vim")) file = "vim";
if (is_substr (subject, "slang")) file = "slang";
if (is_substr (subject, "jed")) file = "jed";
if (is_substr (subject, "slrn")) file = "slrn";
% Not very likely that I'll edit the name,
% if I don't like it, I'll just type in a new one.
file = read_mini ("Append to folder", file, "");
append_article_save (complete_filename (file));
}
definekey ("my_save", "o", "article");
--
Jan Hlav\'{a}\v{c}ek <lahvak+n@math.ohio-state.edu> (BCC's will bounce)
home page: http://www.math.ohio-state.edu/~lahvak/
slrn page: http://www.math.ohio-state.edu/~lahvak/software/slrn.html
slrn documentation: http://www.math.ohio-state.edu/~lahvak/software/slrn/
Technical Details
Message-ID:
<slrn5ta0eq.e5e.lahvak+n@math.mps.ohio-state.edu>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.readers.mbox.zip!not-for-mailReferences:
<slrn5t7oiv.1hr.guckes@banach.math.fu-berlin.de>Show Full Headers
Complete Article Headers
Message-ID: <slrn5ta0eq.e5e.lahvak+n@math.mps.ohio-state.edu> Subject: Save file names (Was: Re: SLRN Wishlist [970722]) Date: Tue, 22 Jul 1997 00:00:00 +0000 From: lahvak+n@math.ohio-state.edu (Jan Hlavacek) References: <slrn5t7oiv.1hr.guckes@banach.math.fu-berlin.de> Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.readers.mbox.zip!not-for-mail X-Deja-AN: 258179652 Organization: Department of Mathematics, The Ohio State University Reply-To: lahvak+n@math.ohio-state.edu Newsgroups: news.software.readers