OSDN Git Service

update version strings in generated files
[howm/howm.git] / howm-mode.el
index ef94d5f..56c61bb 100644 (file)
@@ -446,6 +446,19 @@ key        binding
       (howm-write-history regexp))
     (funcall action regexp)))
 
+(defun howm-search (regexp fixed-p &optional emacs-regexp filter bufname)
+  (if (string= regexp "")
+      (howm-list-all)
+    (howm-message-time "search"
+      (let* ((trio (howm-call-view-search-internal regexp fixed-p emacs-regexp))
+             (kw (car trio))
+             (name (or bufname (cadr trio)))
+             (items (cl-caddr trio)))
+        (when filter
+          (setq items (funcall filter items)))
+        (howm-normalize-show name items (or emacs-regexp regexp) nil nil kw)
+        (howm-record-view-window-configuration)))))
+
 (defun howm-iigrep (completion-p action)
   (howm-with-iigrep (howm-iigrep-command-for-pattern completion-p)
       howm-iigrep-show-what action
@@ -456,11 +469,16 @@ key       binding
 (defmacro howm-with-iigrep (command-for-pattern show-what action &rest body)
   (declare (indent 3))
   `(let ((*iigrep-post-sentinel* (howm-iigrep-post-sentinel ,action))
+         (howm-view-summary-name "*howmS(preview)*")
+         (howm-view-contents-name "*howmC(preview)*")
          (howm-history-limit 0)
          (*howm-show-item-filename* nil)
          (howm-message-time nil))
-     (iigrep-with-grep ,command-for-pattern ,show-what
-       ,@body)))
+     (unwind-protect
+         (iigrep-with-grep ,command-for-pattern ,show-what
+           ,@body)
+       (mapc (lambda (b) (and (get-buffer b) (kill-buffer b)))
+             (list howm-view-summary-name howm-view-contents-name)))))
 
 (defmacro howm-iigrep-command-for-pattern (&optional fixed-p converter)
   ;; use macro due to dynamic binding. Sigh...
@@ -481,19 +499,6 @@ key        binding
        (save-selected-window
          (funcall ,action pattern)))))
 
-(defun howm-search (regexp fixed-p &optional emacs-regexp filter bufname)
-  (if (string= regexp "")
-      (howm-list-all)
-    (howm-message-time "search"
-      (let* ((trio (howm-call-view-search-internal regexp fixed-p emacs-regexp))
-             (kw (car trio))
-             (name (or bufname (cadr trio)))
-             (items (cl-caddr trio)))
-        (when filter
-          (setq items (funcall filter items)))
-        (howm-normalize-show name items (or emacs-regexp regexp) nil nil kw)
-        (howm-record-view-window-configuration)))))
-
 (defvar *howm-view-window-configuration* nil
   "For internal use")
 (defun howm-view-window-configuration ()