;; covert pdf to text then read it in console (cond ( not window-system ) (add-to-list 'auto-mode-alist '("\\.pdf\\'" . no-pdf)) (defun no-pdf () "Run pdftotext on the entire buffer." (interactive) (let ((modified (buffer-modified-p))) (erase-buffer) (shell-command (concat "pdftotext " (buffer-file-name) " -") (current-buffer) t) (set-buffer-modified-p modified))) )