aboutsummaryrefslogtreecommitdiff
path: root/emacs/.emacs.d/lisp/my/my-net.el
diff options
context:
space:
mode:
authorYuchen Pei <id@ypei.org>2025-01-05 17:34:34 +1100
committerYuchen Pei <id@ypei.org>2025-01-05 17:34:34 +1100
commitbb57c3e606d844000ceb725a4f15f7d92a1d5b67 (patch)
treeb6ce6cf0aa8e619dd3b1de03ff35e34d38961c0a /emacs/.emacs.d/lisp/my/my-net.el
parent72139ef3250f7cad9dad3ccbdc7a829befcb5c5f (diff)
[emacs][gdb] Infobox with gitlab
* emacs/.emacs.d/init/ycp-org.el: Forgot to require 'my-org-remark * emacs/.emacs.d/lisp/my/infobox.el: A utility to display alist in a help buffer * emacs/.emacs.d/lisp/my/my-buffer.el: Add a function that fontify a string with a given mode * emacs/.emacs.d/lisp/my/my-gitlab.el: Example of using infobox, by displaying gitlab project info in a help buffer * emacs/.emacs.d/lisp/my/my-net.el: add a function that fetch a url raw * emacs/.emacs.d/lisp/my/my-prog.el: reduce timeout in gdb completion from 1 to .1 sec, but the code is commented out anyway because it does not work (see preceding comments) * misc/.gdbinit: enable debuginfod and reduce max-completions to 20 to reduce hanging caused by exhaustive search of completions
Diffstat (limited to 'emacs/.emacs.d/lisp/my/my-net.el')
-rw-r--r--emacs/.emacs.d/lisp/my/my-net.el10
1 files changed, 9 insertions, 1 deletions
diff --git a/emacs/.emacs.d/lisp/my/my-net.el b/emacs/.emacs.d/lisp/my/my-net.el
index 1f1cbc6..2574789 100644
--- a/emacs/.emacs.d/lisp/my/my-net.el
+++ b/emacs/.emacs.d/lisp/my/my-net.el
@@ -119,6 +119,14 @@ It checks the STATUS, and if it is ok, saves the payload to FILE-NAME."
decompression
with-header))
+
+(defun my-url-fetch-raw (url &optional decompression with-header)
+ (my-url-fetch-internal
+ url
+ (lambda () (decode-coding-string (buffer-string) 'utf-8))
+ decompression
+ with-header))
+
(defun my-url-fetch-internal (url buffer-processor decompression with-header)
(with-current-buffer (get-buffer-create my-client-buffer-name)
(goto-char (point-max))
@@ -141,7 +149,7 @@ It checks the STATUS, and if it is ok, saves the payload to FILE-NAME."
(list
(cons 'header fields)
(cons 'json (funcall buffer-processor)))
- (funcall buffer-processor)))
+ (when buffer-processor (funcall buffer-processor))))
(error "HTTP error: %s" (buffer-substring (point) (point-max)))))))
(provide 'my-net)