使用Emacs编辑谷歌文档?

使用Emacs编辑谷歌文档?,emacs,google-docs,google-drive-api,org-mode,google-docs-api,Emacs,Google Docs,Google Drive Api,Org Mode,Google Docs Api,如何使用Emacs编辑Google Drive文本文档并将更改镜像回Google文档 我发现了一个,以及一个叫做的东西,它是的一部分,但它们似乎需要Linux或Windows,我在OSX上使用Aquamacs。或者我只是不知道如何安装它们 这可行吗 googlecl可以从macports安装。然后,您可以使用本地emacs打开文件 安装后,您可以按照以下命令操作: $ google docs list # gets a list of the files $ google do

如何使用Emacs编辑Google Drive文本文档并将更改镜像回Google文档

我发现了一个,以及一个叫做的东西,它是的一部分,但它们似乎需要Linux或Windows,我在OSX上使用Aquamacs。或者我只是不知道如何安装它们


这可行吗

googlecl
可以从macports安装。然后,您可以使用本地emacs打开文件

安装后,您可以按照以下命令操作:

$ google docs list          # gets a list of the files
$ google docs get <FILE> /tmp/edit$$.txt   # gets the <FILE> to /tmp/edit$$.tmp
$ emacsclient /tmp/edit$$.tmp
$ google docs upload /tmp/edit$$.tmp <FILE>
$google文档列表#获取文件列表
$google docs get/tmp/edit$$.txt#获取到/tmp/edit$$.tmp的
$emacsclient/tmp/edit$$.tmp
$google docs upload/tmp/edit$$.tmp

然而,我发现,
googledocsget
并没有发挥应有的作用。

不需要获取、编辑(emacs)和将文件推回

首先在mac上安装“谷歌硬盘”。
然后您可以直接编辑该文件。在~/Google\Drive下查看。

使用gdrive的另一个选项(需要头盔才能完成)

(defvar gdocs文件夹id“”
“存储组织到gdocs导出文件的位置,使用'gdrive list-t'查找id”)
(取消gdoc导出缓冲区()
“将当前缓冲区作为google文档导出到由gdocs文件夹id标识的文件夹”
(互动)
(shell命令
(格式为“gdrive upload--convert--mimetype text/plain--parent%s--file%s”
gdocs文件夹id(缓冲区文件名)))
(取消gdoc导入缓冲区(doc)
“将gdocs文件夹id中的文件导入当前缓冲区”
(互动
(名单
(填写“选择一个”:
(分割字符串)
(将shell命令转换为字符串
(在父级\“gdocs文件夹id”中设置格式“gdrive list-q\”“%s”)“\n”))
(插入(替换字符串中的regexp)(字符串?\C-m)(字符串?\C-j)(shell命令到字符串)
(格式为“gdrive下载-s--格式为txt--id%s”(car(拆分字符串文档“”));“”)

我没有尝试过,但是您提到的第一个链接——代码是用Python编写的,因此它很有可能在OSX上正常工作。如果没有,那么你可能会自己找出什么不起作用。除非您尝试,否则您将不知道要使其工作需要多少努力。不过,坦率地说,我会在Org中编辑我需要的任何东西,然后将其导出为openoffice格式并上传到谷歌。。。除非有很多文书工作要做。好的,我安装了谷歌。如何使用emacs服务器编辑Google文档@VY32通过将文件获取到本地文件,使用emacsserver编辑,然后将其推回。只需将
编辑器
环境变量设置为EmacClient,然后使用
谷歌文档编辑
。当您关闭emacs客户端缓冲区时,它将自动下载到临时文件并上载。请注意,这样做会删除google文档中的任何格式。
googlecl
不再工作-返回OAUTH1.0错误(似乎需要迁移到v2。当我尝试在Emacs中编辑我的google Drive文件时,文件为空,看起来像!。当我尝试在Emacs中创建文本文件时(foo.txt),Google Drive web界面似乎无法读取。这适用于存储在Google Drive上的非gdocs文件。因此,这很有用,但最初的问题是关于编辑Google文档。
(defvar gdocs-folder-id "<gdrive folder for exported docs>"
 "location for storing org to gdocs exported files, use 'gdrive list  -t <foldername>' to find the id")

(defun gdoc-export-buffer ()
  "Export current buffer as google doc to folder irentified by gdocs-folder-id"
  (interactive)
  (shell-command
  (format "gdrive upload --convert --mimetype text/plain --parent %s --file %s"
      gdocs-folder-id buffer-file-name)))

(defun gdoc-import-buffer (doc)
   "Import a file in gdocs-folder-id into current buffer"
   (interactive 
   (list
      (completing-read "Choose one: "
                 (split-string
                  (shell-command-to-string
                   (format "gdrive list -q \"'%s' in parents\"" gdocs-folder-id)) "\n"))))
  (insert (replace-regexp-in-string (string ?\C-m) (string ?\C-j) (shell-command-to-string
  (format "gdrive download -s --format txt --id %s" (car (split-string doc " ")))))))