aboutsummaryrefslogtreecommitdiff
path: root/sx-encoding.el
diff options
context:
space:
mode:
authorSean Allred <code@seanallred.com>2014-11-20 20:46:52 -0600
committerSean Allred <code@seanallred.com>2014-11-20 20:46:52 -0600
commitb2e59bb1f230267ec5257582478117737cc10049 (patch)
tree29c8bda490c43fee66a9cf1383ff30afc4ef3e81 /sx-encoding.el
parent48e3e7bfd485901e90d807e4470ce8d192459933 (diff)
GitHub comments -- #77
Diffstat (limited to 'sx-encoding.el')
-rw-r--r--sx-encoding.el16
1 files changed, 6 insertions, 10 deletions
diff --git a/sx-encoding.el b/sx-encoding.el
index 8af020e..f683615 100644
--- a/sx-encoding.el
+++ b/sx-encoding.el
@@ -61,7 +61,6 @@
upsilon "υ" uuml "ü" Uuml "Ü" weierp "℘" Xi "Ξ" xi "ξ" yacute "ý"
Yacute "Ý" yen "¥" yuml "ÿ" Yuml "Ÿ" Zeta "Ζ" zeta "ζ" zwj "" zwnj "")
"Plist of HTML entities and their respective glyphs.
-
See `sx-encoding-decode-entities'."
:type '(repeat (choice symbol string))
:group 'sx)
@@ -89,7 +88,6 @@ Return the decoded string."
(defun sx-encoding-normalize-line-endings (string)
"Normalize the line endings for STRING.
-
The API returns strings that use Windows-style line endings.
These are largely useless in an Emacs environment. Windows uses
\"\\r\\n\", Unix uses just \"\\n\". Deleting \"\\r\" is sufficient for
@@ -98,7 +96,6 @@ conversion."
(defun sx-encoding-clean-content (string)
"Clean STRING for display.
-
Applies `sx-encoding-normalize-line-endings' and
`sx-encoding-decode-entities' (in that order) to prepare STRING
for sane display."
@@ -135,8 +132,7 @@ some cases."
(t data))))
(defun sx-encoding-gzipped-p (data)
- "Checks for magic bytes in DATA.
-
+ "Check for magic bytes in DATA.
Check if the first two bytes of a string in DATA match the magic
numbers identifying the gzip file format.
@@ -145,15 +141,15 @@ See URL `http://www.gzip.org/zlib/rfc-gzip.html'."
(equal (substring (string-as-unibyte data) 0 2)
(unibyte-string 31 139)))
-(defun sx-encoding-gzipped-buffer-p (filename)
- "Check if the BUFFER is gzip-compressed.
-
+(defun sx-encoding-gzipped-buffer-p (buffer)
+ "Check if BUFFER is gzip-compressed.
See `sx-encoding-gzipped-p'."
- (sx-encoding-gzip-check-magic (buffer-string)))
+ (with-current-buffer buffer
+ (sx-encoding-gzip-check-magic
+ (buffer-string))))
(defun sx-encoding-gzipped-file-p (file)
"Check if the FILE is gzip-compressed.
-
See `sx-encoding-gzipped-p'."
(let ((first-two-bytes (with-temp-buffer
(set-buffer-multibyte nil)