Thursday 15 May 2014

emacs - How can I set the encoding of shell-command-on-region output? -


I have a small Ellis script that applies to Perl :: Free Zone or full file for reference, here script (Taken from EmacsWiki):

  (defun perltidy- command (initial end) "perltidy command we pass markers." (Shell-command-on-field "Barrel's One area "(interactive" p ") (let ((point) (start) (end)) (if (and mark-activated transient-mark-mode) (setq start (q End-of-the-end (point-to-minute) end (point-max) ()) (global-set-key "\ c-CT" 'Perlatti-Dwm')  

The problem I am facing for the current MX 23.1 Windows (MXSW 32) is that if I use that script on the "U (UNIX)" in the UTF-8 encoded file If I apply the output comes back to the Latin-1 code, that is, every non-

< Strong> edit : The problem is being solved using (set-terminal) -coding-system 'UTF-8-UNIX) my init.el < In / code> In any other solution, go ahead and write them down!

shell-command-on-field ( ch f shell - Command-On-field RET ):

To specify a coding system for converting non-ASCII characters, input and output to shell command, with this command First use CX RECT C By default, the input (from the current buffer) is encoded in the same coding system that will be used to save the file, if 'buffer-file-coding-system' is going to change the output area It is decoded with the same coding system.

Start, ed, commands, output-buffer, replays, error-buffers, and display-error-buffers, non-active arguments. Non-interactive caller coding systems can be specified by 'coding-system-to-read' and 'coding-system-for-write' binding. In other words, you >

  (but read (coding-system-utf-8-unix)) (shell-command-on-field ...))  

This is untested, it is not certain that instead of coding-system-to-read (or maybe -write )? ?) Should be in your value. I think you can also use the output buffer logic and guide the buffer to the output whose coding system requires it for you.

Another option perltidy invocation, but again, without further information about what you are using now, and there is no point in using it on a system like yours, I only point Can i


No comments:

Post a Comment