Winapi 如何在Win32上从Emacs打印?
我正在Windows XP上运行从下载的Emacs 23.0.60.1,并将网络打印机配置为默认打印机 如何设置Emacs以轻松打印缓冲区内容 修补过的Emacs版本的Win32提到了快速和轻松打印,但是快速打印菜单项没有出现,常规条目打印缓冲区、Postscript打印缓冲区似乎没有任何作用 编辑: 我对Emacs 22.3的官方windows版本也有同样的问题。因此,任何版本的安装/故障排除说明将不胜感激 编辑2: 我使用了Joe Casadonte在下面介绍的PrintFile解决方案,效果很好。不过,我还是想知道为什么正确的方法不起作用Winapi 如何在Win32上从Emacs打印?,winapi,emacs,printing,Winapi,Emacs,Printing,我正在Windows XP上运行从下载的Emacs 23.0.60.1,并将网络打印机配置为默认打印机 如何设置Emacs以轻松打印缓冲区内容 修补过的Emacs版本的Win32提到了快速和轻松打印,但是快速打印菜单项没有出现,常规条目打印缓冲区、Postscript打印缓冲区似乎没有任何作用 编辑: 我对Emacs 22.3的官方windows版本也有同样的问题。因此,任何版本的安装/故障排除说明将不胜感激 编辑2: 我使用了Joe Casadonte在下面介绍的PrintFile解决方案,效
顺便问一下,这是一个适当的SO问题,只是与编程有点关系吗?这不是正确的方法,但我已经用这种方法做了很多年,效果非常好。我使用,一个免费的打印程序,也可以单独使用。然后我的.emacs中有这个:
(defun joc-make-fname-from-buffer-name (buffer-name-in)
"Returns a valid filename from a given buffer name"
(interactive "b")
(save-match-data
(let* ((start (string-match "[^ \*]" buffer-name-in))
(end (string-match "[ \*]*$" buffer-name-in (match-end 0)))
(rc (substring buffer-name-in start end)))
;; remove some special characters
(while (string-match "[:]+" rc)
(setq rc (replace-match "_" t t rc)))
rc)))
(when is-win32
(defun joc-print-buffer-or-region (prefix)
"Prints buffer or region via PrintFile32. If a prefix arg is set (via C-u) then
the current region is printed, otherwise the current buffer is printed."
(interactive "P")
;; ----- set the print directory, fname and args -----
(let* ((print-dir (expand-file-name "~/emacs/print"))
(print-fname (joc-make-fname-from-buffer-name (buffer-name)))
(print-fullpath (concat print-dir "/" print-fname))
(print-args "/delete")
;; ----- set rstart and rend to the current region -----
(rstart (point-min)) (rend (point-max)))
;; ----- if prefix given, set them to region -----
(if (and prefix)
(if (and (point) (mark) (/= (point) (mark)))
(progn (setq rstart (min (point) (mark)))
(setq rend (max (point) (mark))))
(error "No region defined")))
;; ----- make the directory -----
(if (not (file-directory-p print-dir))
(make-directory print-dir))
;; ----- write buffer/region to a temp file, print it, delete directory -----
(write-region rstart rend print-fullpath)
(call-process "prfile32" nil t nil print-args print-fullpath)
(delete-directory print-dir))))
我已经好几年没有研究过它了,因为它可以正常工作,所以我相信它可以改进。将以下行添加到您的emacs init文件中
(setq printer-name "//domain/printer-name")
我将介绍Windows7中使用通用USB打印机的所有内容。在需要时根据您的版本调整流程。网络通常可以以相同的方式访问。只需使用//NetworkComputerName/sharedprinter而不是//MyComputer/MyPrinter,并跳过步骤1-6 进入开始->控制面板->硬件和声音->设备和打印机 右键单击打印机,选择打印机属性 转到“共享”并选中“共享此打印机”和“在客户端计算机上渲染打印作业” 输入共享名:MyPrinter或一些您可以记住且没有空格的内容。 单击“确定”保存更改。 转到开始->计算机以检查左下角的计算机名称,例如MyComputer 在Emacs中,评估setq打印机名称//MyComputer/MyPrinter或将其放入.Emacs.el文件中 完成。您可以使用M-x打印缓冲区打印文件
我从Win32 Emacs 22升级到Win32 Emacs 23,并发现了相同的问题:打印缓冲区菜单不再像文档中描述的那样工作。当然,我完全没有跟进这个问题。re:恰当,所以问题-是的,我认为这是恰当的。Emacs和VIM的问题一直在这里被问和回答;感谢您指向一个优秀的应用程序!但是-我怎样才能添加对非拉丁字符的支持,或者UTF-8和b通过单词而不是字符换行?不过,这些可能是PrintFile的问题,而不是Emacs的问题。谢谢恐怕我不知道-对不起。