public
Description: my emacs configuration.
Clone URL: git://github.com/crazycode/emacs.d.git
made some small changes to rails-cmd-proxy.el which decode the color
escape strings in the web log results displayed in the *RWebServer*
buffer.

see
http://groups.google.com/group/emacs-on-rails/browse_thread/thread/ce23649
5c7b47a5c.
crazycode (author)
Sat Aug 23 10:06:02 -0700 2008
commit  8efdd6af5dd270f1afcfd221ae66e30ea17bb1ca
tree    aa3997df9d8dd13b2eddc289d87a432242c96298
parent  2181e9331dc8556a6a2ee692fee4af8db207362a
...
79
80
81
82
83
84
85
 
 
 
 
 
 
 
 
 
 
 
 
86
87
88
...
117
118
119
 
 
 
 
 
 
 
 
 
 
 
120
...
79
80
81
 
 
 
 
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
...
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
0
@@ -79,10 +79,18 @@ otherwise if set REVERSE convert from remote to local."
0
                                                    command
0
                                                    command-args))
0
        (setq command rails-cmd-proxy:remote-cmd))
0
- (start-process-shell-command name
0
- buffer
0
- command
0
- command-args))))
0
+
0
+;;; (start-process-shell-command name
0
+;;; buffer
0
+;;; command
0
+;;; command-args))))
0
+ (let ((process (start-process-shell-command name
0
+ buffer
0
+ command
0
+ command-args)))
0
+ (set-process-filter process
0
+ 'ansi-color-insertion-filter)
0
+ process))))
0
 
0
 (defun rails-cmd-proxy:shell-command-to-string (command)
0
   (rails-project:with-root
0
@@ -117,4 +125,15 @@ otherwise if set REVERSE convert from remote to local."
0
                                 (string-repeat " " (- (length (match-string 1)) 1)))
0
                         nil t nil 1))))))
0
 
0
+(defun ansi-color-insertion-filter (proc string)
0
+ (with-current-buffer (process-buffer proc)
0
+ (let ((moving (= (point) (process-mark proc))))
0
+ (save-excursion
0
+ ;; Insert the text, advancing the process marker.
0
+ (goto-char (process-mark proc))
0
+ ;; decode ansi color sequences
0
+ (insert (ansi-color-apply string))
0
+ (set-marker (process-mark proc) (point)))
0
+ (if moving (goto-char (process-mark proc))))))
0
+
0
 (provide 'rails-cmd-proxy)

Comments

    No one has commented yet.