Guest User

Untitled

a guest
Jun 21st, 2018
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.05 KB | None | 0 0
  1. document.tex
  2. document.log
  3. document.pdf
  4. document.bbl
  5. document.aux
  6. ...
  7.  
  8. ~/Documents/.../doc<TAB>
  9.  
  10. (defadvice find-file-read-args (around find-file-read-args-limit-choices activate)
  11. "set some stuff up for controlling extensions when tab completing"
  12. (let ((completion-ignored-extensions completion-ignored-extensions)
  13. (find-file-limit-choices t))
  14. ad-do-it))
  15.  
  16. (defadvice minibuffer-complete (around minibuffer-complete-limit-choices nil activate)
  17. "When in find-file, check for files of extension .tex, and if they're found, ignore .log .pdf .bbl .aux"
  18. (let ((add-or-remove
  19. (if (and (boundp 'find-file-limit-choices) find-file-limit-choices
  20. (save-excursion
  21. (let ((b (progn (beginning-of-line) (point)))
  22. (e (progn (end-of-line) (point))))
  23. (directory-files (file-name-directory (buffer-substring-no-properties b e)) nil "\.tex$"))))
  24. 'add-to-list
  25. 'remove)))
  26. (mapc (lambda (e) (setq completion-ignored-extensions
  27. (funcall add-or-remove 'completion-ignored-extensions e)))
  28. '(".log" ".pdf" ".bbl" ".aux")))
  29. ad-do-it)
Add Comment
Please, Sign In to add comment