2016-10-04 41 views

回答

2

看起來不像json-reformat帶有任何東西了點。

這裏是一個互動的功能,可以這樣做:

(defun json-to-single-line (beg end) 
    "Collapse prettified json in region between BEG and END to a single line" 
    (interactive "r") 
    (if (use-region-p) 
     (save-excursion 
     (save-restriction 
      (narrow-to-region beg end) 
      (goto-char (point-min)) 
      (while (re-search-forward "\\s-+" nil t) 
      (replace-match " ")))) 
    (print "This function operates on a region"))) 

只是評價函數定義 - >突出JSON片斷你想重新格式化 - >和調用這個函數交互

+0

真棒,謝謝!我把它放在我的.emacs文件中。 – alexgbelov