forked from RobertCNelson/omap-image-builder
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
emacs helper: sanitize package lists so they can be diff'd
- Loading branch information
Michael Haberler
committed
Apr 10, 2016
1 parent
52129db
commit b678c50
Showing
2 changed files
with
66 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#!/usr/bin/python | ||
# I do not understand the insanities of Emacs Lisp. | ||
|
||
import sys | ||
data=sorted(sys.stdin.read().replace('\n', '').replace('\\', '').replace('"', '').split()) | ||
tabbed = ['\t' + name for name in data] | ||
print '"\t\\\n'+ '\t\\\n'.join(tabbed) + '\t\\\n"' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
;; goal: sanitize package lists so they can be reasobably diff'ed | ||
|
||
;; approach: define an emacs function which transforms this: | ||
|
||
;; fasel="apt-transport-https alsa-utils apache2 autoconf automake avahi-daemon bash-completion \ | ||
;; u-boot-tools usb-modeswitch usbutils v4l-utils vim wget wireless-tools \ | ||
;; wpasupplicant wvdial zd1211-firmware" | ||
|
||
;; into this (in-place): | ||
|
||
;; fasel=" \ | ||
;; alsa-utils \ | ||
;; apache2 \ | ||
;; apt-transport-https \ | ||
;; autoconf \ | ||
;; automake \ | ||
;; avahi-daemon \ | ||
;; bash-completion \ | ||
;; u-boot-tools \ | ||
;; usb-modeswitch \ | ||
;; usbutils \ | ||
;; v4l-utils \ | ||
;; vim \ | ||
;; wget \ | ||
;; wireless-tools \ | ||
;; wpasupplicant \ | ||
;; wvdial \ | ||
;; zd1211-firmware \ | ||
;; " | ||
|
||
;; usage: mark region including double quotes, then execute M-/ | ||
|
||
|
||
;; file this into a Python script: | ||
|
||
;; #!/usr/bin/python | ||
|
||
;; import sys | ||
;; data=sorted(sys.stdin.read().replace('\n', '').replace('\\', '').replace('"', '').split()) | ||
;; tabbed = ['\t' + name for name in data] | ||
;; print '"\t\\\n'+ '\t\\\n'.join(tabbed) + '\t\\\n"' | ||
|
||
;; fix scriptName below | ||
;; add to .emacs | ||
|
||
|
||
|
||
;; lifted from: http://ergoemacs.org/emacs/elisp_perl_wrapper.html | ||
|
||
(defun do-something-region (startPos endPos) | ||
"Do some text processing on region. | ||
This command calls the external script “wc”." | ||
(interactive "r") | ||
(let (scriptName) | ||
(setq scriptName "/home/mah/omap-image-builder/emacs/fixpkglists.py") ; full path to your script | ||
(shell-command-on-region startPos endPos scriptName nil t nil t) | ||
)) | ||
|
||
(global-set-key (kbd "M-/") 'do-something-region ) |