branch: externals/doc-toc commit f643745b0679845db7968f430e502c960889465e Author: Daniel Nicolai <dalanico...@gmail.com> Commit: Daniel Nicolai <dalanico...@gmail.com>
Set windows encoding for djvu --- toc-mode.el | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/toc-mode.el b/toc-mode.el index 814c2c94ed..fe7f6daadd 100644 --- a/toc-mode.el +++ b/toc-mode.el @@ -252,9 +252,11 @@ ARG (\\[universal-argument]) to enter different separators." ;;; toc extract (defun toc-document-extract-pages-text (startpage endpage) "Extract text from text layer of current document from STARTPAGE to ENDPAGE." - (let* ((default-process-coding-system '(windows-1252-unix . utf-8-unix)) - (source-buffer (current-buffer)) + (let* ((source-buffer (current-buffer)) (ext (url-file-extension (buffer-file-name (current-buffer)))) + (default-process-coding-system + (cond ((string= ".pdf" ext)'(windows-1252-unix . utf-8-unix)) + ((string= ".djvu" ext) '(utf-8-unix . utf-8-unix)))) (shell-command (cond ((string= ".pdf" ext) "pdftotext -f %s -l %s -layout %s -") ((string= ".djvu" ext) "djvutxt --page=%s-%s %s") (t (error "Buffer-filename does not have pdf or djvu extension"))))