Support both sync/async request
Support streaming request
Support retry for timeout
Support proxies configuration
Support file upload/download
Example:
(pdd "https://httpbin.org/post"
:headers '(("Content-Type" . "application/json"))
:data '(("key" . "value"))
:done (lambda (res) (tooltip-show res))
:fail (lambda (err) (message "FAIL")))
5 个赞
这个库和plz.el
怎么async
使用,还是说自动针对某几个method启用?
不带 :done 是同步,带了是异步。
;; 不带 :done 是同步
(message "%s"
(raq "https://httpbin.org/user-agent"))
;; 带了 callback,自然是异步
(raq "https://httpbin.org/user-agent"
:done (lambda (r) (message "%s" r)))
2 个赞
wsug
2025 年3 月 18 日 02:44
4
请教大佬,我习惯的用法是,elisp发起http请求,然后将请求结果显示在一个org-mode的页面中,代码类似这样
(raq "http://localhost/english-.php"
:done (lambda (r)
(with-current-buffer "a3.org"
(erase-buffer)
(save-excursion
(insert (format "%s" r)) )
)) )
因为服务端也是我自己写的,我可以让服务端返回一个完整的org文件,让org文件包含链接带有交互性就实现了像使用网页应用一样使用org-mode。
因为服务端我自己写我可以让其返回的org文件的第一行是当前页面url,但我想在elisp端实现这个功能,这样就当服务端不是我自己写时也能用。也就是一个如何在回调函数callback中获取当前页面url的问题
没明白你的意思,http://localhost/english-.php
不就是具体 url 吗,需要额外获取吗?
比如:
(let ((url "https://www.bilibili.com"))
(raq url :done
(lambda ()
(with-current-buffer "*scratch*"
(insert url)))))
wsug
2025 年3 月 18 日 06:07
6
应该是需要额外获取,在回调函数中取不到这个url,你给的代码我eval了,~报 error in process filter: save-current-buffer: Symbol’s value as variable is void: url
error in process filter: Symbol’s value as variable is void: url ~
wsug
2025 年3 月 18 日 06:39
7
@lorniu 你的写法没错,emacs -q后可以取到,是我的配置有问题,就显示Symbol’s value as variable is void: url
,调试了一会也无果,这可能是个隐藏bug,希望能找到原因吧
yibie
2025 年3 月 19 日 02:15
9
你是说这位吧,我真的不喜欢这个人,感觉有他做版主的一天,Emacs 就很难流行。
另外我觉得这个人很夹带私货,只要是自己开发过的,别人就不用再弄了一样。
呀,上帝都没办法让人类建巴别塔,他一个区区人类这么牛逼。
怼怼更健康:
lorniu
2025 年3 月 19 日 02:22
10
才发现原来是 plz
的作者,难怪…
话说有个添加 PATCH 请求支持的补丁,有人提了一年多了一直不合并。今天看到我发的这个,立刻合了。挺逗。
1 个赞
lorniu
2025 年3 月 19 日 02:24
12
没必要这么怼吧,Emacs 圈子这么小,还是多一些友善为好
yibie
2025 年3 月 19 日 02:26
13
他作为版主,我认为他已经失去了管理职能。一味把 r/emacs 作为自己的私有领地。
如果你经常上去,看到他的作为,你就会知道我为什么要这么怼他。
以及,他经常删除对自己不利的帖子,并非一个正心正念的人。
没有什么没必要的。该怼就得怼,这些不要脸的人,就应该大声说出来这些人不要脸。
另外,一个想法不一定对,想让这个世界变得更好,应当管理冲突,而非回避冲突。
2 个赞
lorniu
2025 年3 月 19 日 02:39
16
我曹。。。真够疯的啊。我向 melpa 提了这个包,它在下面激烈反对合并。我真的是。。。无语了。。。
melpa:master
← lorniu:raq.el
已打开 04:31PM - 09 Mar 25 UTC
### Brief summary of what the package does
raq is an HTTP Library Adapter for… Emacs. It support `url.el` and `plz`, and can be extended.
It provides API which is simple and uniform, and with some features like:
- Support both **sync/async** request
- Support **streaming** request
- Support **retry** for timeout
- Support **proxies** configuration
- Support file **upload/download**
### Direct link to the package repository
https://github.com/lorniu/raq.el
### Your association with the package
maintainer
### Relevant communications with the upstream package maintainer
**None needed**
### Checklist
- [x] The package is released under a [GPL-Compatible Free Software License](https://www.gnu.org/licenses/license-list.en.html#GPLCompatibleLicenses)
- [x] I've read [CONTRIBUTING.org](https://github.com/melpa/melpa/blob/master/CONTRIBUTING.org)
- [x] I've used the latest version of [package-lint](https://github.com/purcell/package-lint) to check for packaging issues, and addressed its feedback
- [x] My elisp byte-compiles cleanly
- [x] I've used `M-x checkdoc` to check the package's documentation strings
- [x] I've built and installed the package using the instructions in [CONTRIBUTING.org](https://github.com/melpa/melpa/blob/master/CONTRIBUTING.org)
lorniu
2025 年3 月 19 日 03:24
17
我有种被它网络暴力了的感觉…
melpa:master
← lorniu:master
已打开 09:48AM - 05 Mar 25 UTC
### Brief summary of what the package does
Automatically show hidden emphasis… markers at point in org mode.
This is useful for editing org file when org-hide-emphasis-markers is on.
In org mode, hide emphasis markers can make reading nice, but not good for editing. Here provide a mode to let hidden markers auto expose when the cursor on, and auto hide when cursor leave.
### Direct link to the package repository
https://github.com/lorniu/org-expose-emphasis-markers
### Your association with the package
the maintainer
### Relevant communications with the upstream package maintainer
**None needed**
### Checklist
- [x] The package is released under a [GPL-Compatible Free Software License](https://www.gnu.org/licenses/license-list.en.html#GPLCompatibleLicenses)
- [x] I've read [CONTRIBUTING.org](https://github.com/melpa/melpa/blob/master/CONTRIBUTING.org)
- [x] I've used the latest version of [package-lint](https://github.com/purcell/package-lint) to check for packaging issues, and addressed its feedback
- [x] My elisp byte-compiles cleanly
- [x] I've used `M-x checkdoc` to check the package's documentation strings
- [x] I've built and installed the package using the instructions in [CONTRIBUTING.org](https://github.com/melpa/melpa/blob/master/CONTRIBUTING.org)
PS: org-expose-emphasis-markers 这个包挺好的,可以直接在 melpa 下载,欢迎尝试啊。
2 个赞
自由确实有点像个伪命题,想起以前看过的一本书《自由及其背叛》,很有意思。
他说你直接复制了plz.el
的代码?这个指控成立吗?
yibie:
感觉有他做版主的一天,Emacs 就很难流行
可能你不知道,这位上任版主应该是在24年末25年初的事,只不过之前也在r/emacs积极活跃
因为你被他怼了?但他说的也有道理,org-embd的作用机制完全可以独立于org-mode存在。
yibie
2025 年3 月 19 日 10:47
21
因为你被他怼了?但他说的也有道理,org-embd的作用机制完全可以独立于org-mode存在
他说的是有道理,但无法解决问题——有什么办法,除了使用 Xwidget 之外,可以让视频播放,嵌入到 org 文件之中。另外,org-embd 这一套机制,需要依赖 org-link 类型,否则无法在文件中定位。
他说和 org-mode 无关的理由,又从何成立。
同理,懒猫的 EAF 这一套框架,也可以被他喷为和 Emacs 无关。
另外,我不觉得被怼,这只是看待问题角度而产生的分歧。
他现在的经常锁贴,还有删除之前 r/emacs 上一个对他管理方法的吐槽。他的反应是,「在座的都没有理性,我之前做了很多贡献,巴拉巴拉」。
我之前在社区内部宣传过他的 org-ql 这个包。以及我很清楚他开发了大量其它的包,为 Emacs 和 org-mode 社区所做的贡献。问题是,他开发了什么,别人就不能继续开发了吗?解决一个问题,必须用他的方法是吗?
他的做法,让我大跌眼镜,我无法认同他处理问题时,将社区这个公器私用的方式。我质疑他的人品,以及我不会再用任何一个和他有关系的包。
至于你对他的观感如何,和我无关,以及我对他的观感,也与你无关——我无意冒犯任何人,以及我确实没有冒犯你的理由和行为。
还有,你对我的观感,也和我无关。大家只是因为 Emacs 在这个社区活跃。
1 个赞