[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Questions on window functions, etc.

Glad to see this mailing list start up.  Here's a few quick questions for the
MACL community.

Below you will find a small piece of code I wrote to facilitate the printing of
source listings.  I got tired of manually opening and printing a half dozen
source files which had changed in the middle of a directory of several dozen
files.  But I can't do "quite" what I want yet.

1.  Is there any way to give the window-hardcopy (Fred window) function addit-
ional arguments to avoid the printer dialog box.  I still have to sit around
and click "OK" for each file (hence the ed-beep attention getter).

2.  The header printed on each page is different than that which you get if you
use the Print command from the File menu -- The filename is listed in the Fred
window title "filename {...part-of-path}" style rather than the full pathname.
Also, more importantly, the date in the header is the current time rather than
the file modification time.  Is there any way to change this?  Invoke the menu
item action function for the Print command instead of window-hardcopy?

3.  If I cancel out of the print dialog box, there doesn't seem to be any way to
detect this in my code.  Is there?

4.  Here's a typo from page 230 of the manual, last paragraph.  The 
"mac-volume" is really named "mac-volume-number".

5.  Another on page 284, second paragraph.  The buffer function name is really
"ed-skip-fwd-wsp&comments".  Seems funny to have a "&" in the middle of a
function name, and it tripped up your automatic formatter, too.

Mike Wirth
GeoQuest Intl, Houston

----------------------------Here's the code---------------------------------
(defun print-new-files ()
  "Interacts with the user to select and print text files modified since
   a specified date from a selected directory"
    ((search-path (choose-new-file-dialog :prompt "Search string, e.g., *.lisp"
                                          :button-string "OK"))
     (date-string (get-string-from-user
                   "Enter starting date as a list of numbers, i.e., (yyyy mm
                   (format nil "~A"
                           (reverse (subseq (multiple-value-list
                                             (get-decoded-time)) 3 6)))))
     (start-time (apply #'encode-universal-time
                        (append '(0 0 0) (reverse (read-from-string
     (all-file-path-list (directory search-path))
     (new-file-path-list (select-newer-text-files all-file-path-list
    (dolist (file new-file-path-list)
      (setq fred-wndw (oneof *fred-window* :scratch-p t :filename file))
      (ask fred-wndw (set-window-size 486 200))  ;;; To fit under the print
dialog box
      (ask fred-wndw (set-window-position 77 167))
      (ask fred-wndw (window-hardcopy))
      (format t "~%~A" (mac-namestring file))
      (ask fred-wndw (window-close)))

(defun select-newer-text-files (file-path-list time)
  "From a list of file pathnames, create a list of text files modified since
   #'(lambda (pathname)
       (if (and (>= (file-write-date pathname) time)
                (eq (mac-file-type pathname) :text))

PS:  Whoops--some lines wrapped around at 80 col. above.  You'll have to fix