Ticket #162: lisp-complete-symbol-2.patch

File lisp-complete-symbol-2.patch, 1.8 kB (added by gotoh, 3 years ago)

従来の挙動を維持しつつscrollする為の修正案

  • lisp.el

    old new  
    522522considered." 
    523523  (interactive) 
    524524 
    525   (let ((window (get-buffer-window "*Completions*"))) 
     525  (let* ((end (point)) 
     526         (beg (with-syntax-table emacs-lisp-mode-syntax-table 
     527                (save-excursion 
     528                  (backward-sexp 1) 
     529                  (while (= (char-syntax (following-char)) ?\') 
     530                    (forward-char 1)) 
     531                  (point)))) 
     532         (pattern (buffer-substring-no-properties beg end)) 
     533         (window (get-buffer-window "*Completions*"))) 
    526534    (if (and (eq last-command this-command) 
    527535             window (window-live-p window) (window-buffer window) 
    528              (buffer-name (window-buffer window))) 
     536             (buffer-name (window-buffer window)) 
     537             (string= (with-current-buffer (window-buffer window) 
     538                        last-pattern) pattern)) 
    529539        ;; If this command was repeated, and 
    530540        ;; there's a fresh completion window with a live buffer, 
    531541        ;; and this command is repeated, scroll that window. 
     
    537547              (scroll-up)))) 
    538548 
    539549      ;; Do completion. 
    540       (let* ((end (point)) 
    541              (beg (with-syntax-table emacs-lisp-mode-syntax-table 
    542                     (save-excursion 
    543                       (backward-sexp 1) 
    544                       (while (= (char-syntax (following-char)) ?\') 
    545                         (forward-char 1)) 
    546                       (point)))) 
    547              (pattern (buffer-substring-no-properties beg end)) 
    548              (predicate 
     550      (let* ((predicate 
    549551              (or predicate 
    550552                  (save-excursion 
    551553                    (goto-char beg) 
     
    587589                       (setq list (nreverse new)))) 
    588590                 (with-output-to-temp-buffer "*Completions*" 
    589591                   (display-completion-list list))) 
     592               (with-current-buffer "*Completions*" 
     593                 (set (make-local-variable 'last-pattern) pattern)) 
    590594               (message "Making completion list...%s" "done"))))))) 
    591595 
    592596;;; arch-tag: aa7fa8a4-2e6f-4e9b-9cd9-fef06340e67e