Lisp HUG Maillist Archive

How to have default "Filenames Pattern" in Search Files in IDE

When I open Search Files in the LWW6 IDE, I'd like "Filenames Pattern"
to default to something - either the last path and filter I used or one
that I can specify in a preference.

It looks like there is something related in Preferences..Search
Files..Search Parameters..Pattern, but after entering, for example,
"*.lisp" there, I still have a blank input box in Search Files.

Mitch

_______________________________________________
Lisp Hug - the mailing list for LispWorks users
lisp-hug@lispworks.com
http://www.lispworks.com/support/lisp-hug.html


Re: How to have default "Filenames Pattern" in Search Files in IDE

Sorry... should have included an example of its use...

(defun playback-recorded-audio ()
  (with-accessors ((playback-info        fmt-session-playback-info)
                   (audio-recording-lock fmt-session-audio-recording-lock))
      *session*
    (um:with-remembered-filename (fname :com.sd.fmt.last-wave-file)
        (capi:prompt-for-file "Select File for Playback"
                              :filter "*.wav"
                              :pathname fname
                              :operation :open)
      (mp:with-lock (audio-recording-lock)
        (stop-wav-audio)
        (let ((info (fli:allocate-foreign-object
                     :type 'wchunkinfo)))
          (win32-open-wave (namestring fname) info)
          (setf playback-info info)))
      fname) ))



On Sep 9, 2013, at 08:31 AM, Mitch Berkson <mitch@bermita.com> wrote:


When I open Search Files in the LWW6 IDE, I'd like "Filenames Pattern"
to default to something - either the last path and filter I used or one
that I can specify in a preference.

It looks like there is something related in Preferences..Search
Files..Search Parameters..Pattern, but after entering, for example,
"*.lisp" there, I still have a blank input box in Search Files.

Mitch

_______________________________________________
Lisp Hug - the mailing list for LispWorks users
lisp-hug@lispworks.com
http://www.lispworks.com/support/lisp-hug.html



Dr. David McClain
dbm@refined-audiometrics.com



Re: How to have default "Filenames Pattern" in Search Files in IDE

;; ----------------------------------------------------------

(defvar *remembered-filenames*
  (make-hash-table))

(defun remember-filename (key fname)
  (setf (gethash key *remembered-filenames*) fname))

(defun remembered-filename (key)
  (gethash key *remembered-filenames*))

(defun do-with-remembered-filename (key init prompter fn)
  (um:when-let (fname (or init (funcall prompter (remembered-filename key))))
    (remember-filename key fname)
    (funcall fn fname)))
  
(defmacro with-remembered-filename ((fname key &optional init) form &body body)
  `(do-with-remembered-filename ,key ,init
                                (lambda (,fname)
                                  (declare (ignorable ,fname))
                                  ,form)
                                (lambda (,fname)
                                  (declare (ignorable ,fname))
                                  ,@body)))

#+:LISPWORKS
(editor:setup-indent "with-remembered-filename" 2)

On Sep 9, 2013, at 08:31 AM, Mitch Berkson <mitch@bermita.com> wrote:


When I open Search Files in the LWW6 IDE, I'd like "Filenames Pattern"
to default to something - either the last path and filter I used or one
that I can specify in a preference.

It looks like there is something related in Preferences..Search
Files..Search Parameters..Pattern, but after entering, for example,
"*.lisp" there, I still have a blank input box in Search Files.

Mitch

_______________________________________________
Lisp Hug - the mailing list for LispWorks users
lisp-hug@lispworks.com
http://www.lispworks.com/support/lisp-hug.html



Dr. David McClain
dbm@refined-audiometrics.com



Re: How to have default "Filenames Pattern" in Search Files in IDE

Hi Mitch, List!
  I wanted that for a long time too. Your question inspired me to play
around with Works/Interface/Inspect menu item. This seem to work for
me.

(let ((*handle-warn-on-redefinition* nil))

; non-toplevel
(defmethod initialize-instance :around ((i
LISPWORKS-TOOLS:search-files) &rest initargs &key &allow-other-keys)
  "Sets hard-coded values for root directory and patterns in search
files tools initialize-instance. Also,
LISPWORKS-TOOLS::*last-search-files-interface* might be useful"
  (call-next-method)
  (setf
   (capi:text-input-pane-text
    (slot-value i 'LISPWORKS-TOOLS::root-directory-pane))
   "c:/lisp")
  (setf
   (capi:text-input-pane-text
    (slot-value i 'lispworks-tools::patterns-pane))
   "sw/*.l*sp;sw/fb2/*.l*sp;sw/fb2/sp/*.l*sp;sw/fb2/admin/*.l*sp;sw/fb2/app/*.l*sp")
  )

);let

_______________________________________________
Lisp Hug - the mailing list for LispWorks users
lisp-hug@lispworks.com
http://www.lispworks.com/support/lisp-hug.html


Updated at: 2020-12-10 08:35 UTC