tale@pawl.rpi.edu (David C Lawrence) (07/01/89)
In <SHADOW.89Jun30211745@pawl.rpi.edu> shadow@pawl.rpi.edu (Deven T. Corzine): DTC> It should accept anything starting with a + in the FCC: field as an MH DTC> folder and use rcvstore to save it there. Please, someone add this DTC> feature? (I _tried_ the "|/usr/local/lib/rcvstore +Articles" method; DTC> it didn't work. Besides, it's ugly. Plain "+Articles" ought to work.) I agree with you that plain +Articles should work. For those who are curious, Deven's problem with the pipeline not working was not the fault of GNUS but due to the fact that he did not have a +Articles folder and did not specify -create as an argument to rcvstore. I argued with him about "So what that it's ugly, no one ever sees it but you and it works ...", but that was basically an impasse. :-) Anyway, the following diffs to gnuspost.el do two things: o Allow you to specify a FCC which starts with + as a special character that means "save this in my MH folder +foldername using rcvstore". If the folder does not exist you are asked whether you want to create it. o Allow you to have a null-string organization. See an earlier posting of mine regarding this. You can get the same effects by setting gnus-your-organization and gnus-organization-file both to nil and making sure that the environment variable ORGANIZATION is not set. (The patch also does one minor thing by clearing up some overhead by not firing up a shell if FCC is going to pipe the message to a programme.) This patch is UNOFFICIAL and mostly unimportant. It doesn't really fix anything that is broken, just makes a couple of things easier. If you want either or both of these features use this in good health. % diff -c gnuspost.el gnuspostnew.el *** gnuspost.el Mon Jun 26 13:51:37 1989 --- gnuspostnew.el Sat Jul 1 03:14:23 1989 *************** *** 383,391 **** (match-beginning 1) (match-end 1)))) ;; Suggested by yuki@flab.fujitsu.junet. ;; Pipe out article to named program. ! (call-process-region (point-min) (point-max) shell-file-name ! nil nil nil "-c" program) ! )) (t ;; Suggested by hyoko@flab.fujitsu.junet. ;; Save article in Unix mail format. --- 383,410 ---- (match-beginning 1) (match-end 1)))) ;; Suggested by yuki@flab.fujitsu.junet. ;; Pipe out article to named program. ! (call-process-region (point-min) (point-max) ! program nil nil nil))) ! ;; if it starts with a +, save it to an MH folder ! ((string-match "^\\s *\\(\\+\\S +\\)\\s *$" fcc-file) ! (require 'mh-e) ! (or mh-user-path (mh-find-path)) ! (let* ((name (substring fcc-file (match-beginning 1) ! (match-end 1))) ! (folder (mh-expand-file-name name))) ! (or (file-exists-p folder) ! (if (y-or-n-p ! (format "Folder %s doesn't exist. Create? " name)) ! (progn ! (message "Creating %s" folder) ! (call-process "mkdir" nil nil nil folder) ! (message "Creating %s...done" folder) ! (mh-push (list name) mh-folder-list)))) ! (if (file-exists-p folder) ! (call-process-region (point-min) (point-max) ! (concat mh-lib "rcvstore") ! nil nil nil name) ! (message "FCC to %s not saved." name)))) (t ;; Suggested by hyoko@flab.fujitsu.junet. ;; Save article in Unix mail format. *************** *** 544,550 **** (let ((organization (or (getenv "ORGANIZATION") gnus-your-organization (expand-file-name "~/.organization" nil)))) ! (and (stringp organization) (string-equal (substring organization 0 1) "/") ;; Get it from the user and system file. ;; Suggested by roland@wheaties.ai.mit.edu (Roland McGrath). --- 563,569 ---- (let ((organization (or (getenv "ORGANIZATION") gnus-your-organization (expand-file-name "~/.organization" nil)))) ! (and (stringp organization) (string< "" organization) (string-equal (substring organization 0 1) "/") ;; Get it from the user and system file. ;; Suggested by roland@wheaties.ai.mit.edu (Roland McGrath). *************** *** 557,563 **** gnus-organization-file) (t organization))) )) ! (cond ((not (stringp organization)) nil) ((and (string-equal (substring organization 0 1) "/") (file-exists-p organization)) ;; If the first character is `/', assume it is the name of --- 576,582 ---- gnus-organization-file) (t organization))) )) ! (cond ((or (not (stringp organization)) (string= "" organization)) nil) ((and (string-equal (substring organization 0 1) "/") (file-exists-p organization)) ;; If the first character is `/', assume it is the name of This is the trailing garbage your patcher always told you about... Dave -- (setq mail '("tale@pawl.rpi.edu" "tale@itsgw.rpi.edu" "tale@rpitsmts.bitnet")) "Drinking coffee for instant relaxation? That's like drinking alcohol for instant motor skills." -- Mike Price (?)
lawrence@pawl.rpi.edu (David Lawrence) (07/02/89)
Hold the presses, reverse that patch. Here we learn a lesson in the hazards of very rarely changing your development environment and not testing from scratch. My tests of the FCC: +foldername patch didn't pick up the fact that if you don't have mh-e already loaded some nasty things will happen. I already had it provided so I never noticed ... Basically, the problems are these: mh-user-path isn't defvar'ed as nil but as "" (a completely useless original value, but that is another matter ...); additionally, if mh-find-path is run it corrupts the match-data so the let* statement ends up barfing. Ah well, live and learn. The other thing that was pointed out to me is that taking out the overhead of the shell creates the problem of passing arguments to the program via call-process-region. As I was about to fix this I noted that without the shell you also lose the functionality of a longer pipeline or of stdout redirection, so things look best left the way they are in spite of the overhead of the shell process. This is an _unofficial_ patch; if you applied the other (incorrect) one that I submitted in the wee hours of this morning, reverse it and apply this to the distributed gnuspost.el. % diff -c gnuspost.el.orig gnuspost.el *** gnuspost.el.orig Sat Jul 1 14:59:06 1989 --- gnuspost.el Sat Jul 1 15:18:37 1989 *************** *** 386,391 **** --- 386,414 ---- (call-process-region (point-min) (point-max) shell-file-name nil nil nil "-c" program) )) + ((string-match "^\\s *\\(\\+\\S +\\)\\s *^" fcc-file) + ;; Suggested by shadow@pawl.rpi.edu + ;; unofficial patch by tale@rpi.edu + ;; if it starts with a +, save it to an MH folder. + (let ((name (substring fcc-file + (match-beginning 1) (match-end 1))) + folder) + (require 'mh-e) + (if (string= "" mh-user-path) (mh-find-path)) + (setq folder (mh-expand-file-name name)) + (or (file-exists-p folder) + (if (y-or-n-p + (format "Folder %s doesn't exist. Create? " name)) + (progn + (message "Creating %s" folder) + (call-process "mkdir" nil nil nil folder) + (message "Creating %s...done" folder) + (mh-push (list name) mh-folder-list)))) + (if (file-exists-p folder) + (call-process-region (point-min) (point-max) + (concat mh-lib "rcvstore") + nil nil nil name) + (message "FCC to %s not saved." name)))) (t ;; Suggested by hyoko@flab.fujitsu.junet. ;; Save article in Unix mail format. *************** *** 544,550 **** (let ((organization (or (getenv "ORGANIZATION") gnus-your-organization (expand-file-name "~/.organization" nil)))) ! (and (stringp organization) (string-equal (substring organization 0 1) "/") ;; Get it from the user and system file. ;; Suggested by roland@wheaties.ai.mit.edu (Roland McGrath). --- 567,574 ---- (let ((organization (or (getenv "ORGANIZATION") gnus-your-organization (expand-file-name "~/.organization" nil)))) ! ;; patch by tale@rpi.edu to cope with "" organization ! (and (stringp organization) (string< "" organization) (string-equal (substring organization 0 1) "/") ;; Get it from the user and system file. ;; Suggested by roland@wheaties.ai.mit.edu (Roland McGrath). *************** *** 557,563 **** gnus-organization-file) (t organization))) )) ! (cond ((not (stringp organization)) nil) ((and (string-equal (substring organization 0 1) "/") (file-exists-p organization)) ;; If the first character is `/', assume it is the name of --- 581,588 ---- gnus-organization-file) (t organization))) )) ! ;; patched by tale@rpi.edu to deal with "" organization ! (cond ((or (not (stringp organization)) (string= "" organization)) nil) ((and (string-equal (substring organization 0 1) "/") (file-exists-p organization)) ;; If the first character is `/', assume it is the name of -- (setq mail '("tale@pawl.rpi.edu" "tale@itsgw.rpi.edu" "tale@rpitsmts.bitnet")) "Drinking coffee for instant relaxation? That's like drinking alcohol for instant motor skills." -- Mike Price (?)