我有一个文档显示在doc-view缓冲区中.但是,文档向左旋转90度.我可以在emacs doc-view中旋转文档吗?
我也有这个要求.遗憾的是,doc-view不提供此功能.
此外,emacs使用的图像代码无法旋转图像.所以我创建了一个函数,利用ImageMagick转换存储在缓存目录中的png文件,并重新显示当前页面:
(defun doc-view-rotate-current-page () "Rotate the current page by 90 degrees. Requires ImageMagick installation" (interactive) (when (eq major-mode 'doc-view-mode) ;; we are assuming current doc-view internals about cache-names (let ((file-name (expand-file-name (format "page-%d.png" (doc-view-current-page)) (doc-view--current-cache-dir)))) ;; assume imagemagick is installed and rotate file in-place and redisplay buffer (call-process-shell-command "convert" nil nil nil "-rotate" "90" (concat "\"" file-name "\"") (concat "\"" file-name "\"")) (clear-image-cache) (doc-view-goto-page (doc-view-current-page))))))