emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: hexl and running a shell


From: Stefan Monnier
Subject: Re: hexl and running a shell
Date: Fri, 30 Nov 2001 07:37:24 -0500

> > More to the point here: `hexl' is really not a separate program
> > but seems intimately linked to hexl-mode, so I'm wondering how
> > much customization is even possible for hexl-options and
> > hexlify-command and dehexlify-command.
> 
> Then perhaps we should simply remove those defcustom's and make this
> not configurable.  Then call-process-region would be okay, I think.

That would be even better, yes.


        Stefan


Index: hexl.el
===================================================================
RCS file: /cvs/emacs/lisp/hexl.el,v
retrieving revision 1.70
diff -u -u -b -r1.70 hexl.el
--- hexl.el     2001/11/26 16:27:00     1.70
+++ hexl.el     2001/11/30 12:37:03
@@ -72,28 +72,10 @@
   :group 'hexl)
 
 (defcustom hexl-options (format "-hex %s" hexl-iso)
-  "Options to hexl-program that suit your needs."
+  "Options to `hexl-program' that suit your needs."
   :type 'string
   :group 'hexl)
 
-(defcustom hexlify-command
-  (format "%s %s"
-         (shell-quote-argument
-          (expand-file-name hexl-program exec-directory))
-         hexl-options)
-  "The command to use to hexlify a buffer."
-  :type 'string
-  :group 'hexl)
-
-(defcustom dehexlify-command
-  (format "%s -de %s"
-         (shell-quote-argument
-          (expand-file-name hexl-program exec-directory))
-         hexl-options)
-  "The command to use to unhexlify a buffer."
-  :type 'string
-  :group 'hexl)
-
 (defcustom hexl-follow-ascii t
   "If non-nil then highlight the ASCII character corresponding to point."
   :type 'boolean
@@ -634,7 +616,9 @@
   (let ((coding-system-for-read 'raw-text)
        (coding-system-for-write buffer-file-coding-system)
        (buffer-undo-list t))
-    (shell-command-on-region (point-min) (point-max) hexlify-command t)
+    (apply 'call-process-region (point-min) (point-max)
+          (expand-file-name hexl-program exec-directory)
+          t t nil (split-string hexl-options))
     (if (> (point) (hexl-address-to-marker hexl-max-address))
        (hexl-goto-address hexl-max-address))))
 
@@ -649,7 +633,9 @@
   (let ((coding-system-for-write 'raw-text)
        (coding-system-for-read buffer-file-coding-system)
        (buffer-undo-list t))
-    (shell-command-on-region (point-min) (point-max) dehexlify-command t)))
+    (apply 'call-process-region (point-min) (point-max)
+          (expand-file-name hexl-program exec-directory)
+          t t nil "-de" (split-string hexl-options))))
 
 (defun hexl-char-after-point ()
   "Return char for ASCII hex digits at point."




reply via email to

[Prev in Thread] Current Thread [Next in Thread]