読者です 読者をやめる 読者になる 読者になる

*iroi*

mechairoi の Blog

anything.elでプロセスに対しても複数行のバグ

emacs

d:id:rubikitch:20101122:anythingで取り込んで頂いたパッチにprocessの出力が二回以上にわかれて来たときに二回目の挿入位置が前回の位置を覚えていないようで順番とか色々変になるバグを埋め込んでしまいました.
勘で修正してみましたがinsertとinsert-before-markersの違いがまだよくわかってない..

ついでに1個目のcandidateの手前のseparatorを消しました.

--- a/.emacs.d/auto-install/anything.el
+++ b/.emacs.d/auto-install/anything.el
@@ -2227,12 +2227,13 @@ the real value in a text property."
     (put-text-property start (point) 'face anything-header-face)))
 
 
-(defun anything-insert-candidate-separator ()
+(defun anything-insert-candidate-separator (&optional insert-function)
   "Insert separator of candidates into the anything buffer."
-  (insert anything-candidate-separator)
+  (unless insert-function (setq insert-function 'insert))
+  (funcall insert-function anything-candidate-separator)
   (put-text-property (point-at-bol)
                      (point-at-eol) 'anything-candidate-separator t)
-  (insert "\n"))
+  (funcall insert-function "\n"))
 
 
 
@@ -2267,7 +2268,8 @@ the real value in a text property."
     (if (not (assq 'multiline source))
         (anything-insert-match candidate 'insert-before-markers source)
       (let ((start (point)))
-        (anything-insert-candidate-separator)
+        (unless (= (cdr (assoc 'item-count source)) 0)
+          (anything-insert-candidate-separator 'insert-before-markers))
         (anything-insert-match candidate 'insert-before-markers source)
         (put-text-property start (point) 'anything-multiline t)))
     (incf (cdr (assoc 'item-count source)))