@@ -775,18 +775,14 @@ This function will be called with no arguments.")
775
775
replace the whole buffer with the output. If CMD fails the
776
776
buffer remains unchanged."
777
777
(set-buffer-modified-p t )
778
- (flet
779
- ((chomp (str)
780
- (while (string-match " \\ `\n+\\|^\\s-+\\|\\s-+$\\|\n+\\' "
781
- str)
782
- (setq str (replace-match " " t t str)))
783
- str)
784
- (errout
785
- (fmt &rest args)
786
- (let* ((warning-fill-prefix " " ))
787
- (display-warning cmd (apply 'format fmt args) :warning ))))
788
- (let*
789
- ((filename (buffer-file-name (current-buffer )))
778
+ (let* ((chomp (lambda (str )
779
+ (while (string-match " \\ `\n+\\|^\\s-+\\|\\s-+$\\|\n+\\' " str)
780
+ (setq str (replace-match " " t t str)))
781
+ str))
782
+ (errout (lambda (fmt &rest args )
783
+ (let* ((warning-fill-prefix " " ))
784
+ (display-warning cmd (apply 'format fmt args) :warning ))))
785
+ (filename (buffer-file-name (current-buffer )))
790
786
(cmd-prefix (replace-regexp-in-string " .*" " " cmd))
791
787
(tmp-file (make-temp-file cmd-prefix))
792
788
(err-file (make-temp-file cmd-prefix))
@@ -800,26 +796,26 @@ This function will be called with no arguments.")
800
796
(stderr-output
801
797
(with-temp-buffer
802
798
(insert-file-contents err-file)
803
- (chomp (buffer-substring-no-properties (point-min ) (point-max )))))
799
+ (funcall chomp (buffer-substring-no-properties (point-min ) (point-max )))))
804
800
(stdout-output
805
801
(with-temp-buffer
806
802
(insert-file-contents tmp-file)
807
803
(buffer-substring-no-properties (point-min ) (point-max )))))
808
804
(if (string= " " stderr-output)
809
805
(if (string= " " stdout-output)
810
- (errout
806
+ (funcall errout
811
807
" Error: %s produced no output, leaving buffer alone" cmd)
812
808
(save-restriction
813
809
(widen )
814
810
; ; command successful, insert file with replacement to preserve
815
811
; ; markers.
816
812
(insert-file-contents tmp-file nil nil nil t )))
817
813
; ; non-null stderr, command must have failed
818
- (errout " %s failed: %s" cmd stderr-output)
814
+ (funcall errout " %s failed: %s" cmd stderr-output)
819
815
)
820
816
(delete-file tmp-file)
821
817
(delete-file err-file)
822
- )))
818
+ ))
823
819
824
820
(defun haskell-mode-stylish-buffer ()
825
821
" Apply stylish-haskell to the current buffer."
0 commit comments