Skip to content

A minor mode writing markdown note using leanote platform in emacs.

Notifications You must be signed in to change notification settings

AmanYang/leanote-emacs

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

leanote-mode

Build Status MELPA MELPA Stable POPKIT ELPA

A minor mode writing notes in emacs with elegant way leanote and its open source platform.

Install

Install it from elpa source package (i.e. melpa or popkit elpa).

M-x package-install RET leanote RET

Manually install, download leanote.el file to folder /path/to/leanote/

(add-to-list 'load-path "/path/to/leanote/")
(require 'leanote)
(add-hook 'markdown-mode-hook
          (lambda ()
            (leanote)
            (leanote-spaceline-status)  ;; optional, use it if necessary
            ))

Usage

After install, add following code to your init(.emacs or init.el anyway) file.

(add-hook 'markdown-mode-hook 'leanote)

Note: Config your own server api if you use youself host(vps) as following

(setq leanote-api-root "https://your-domain/api")

Actions

  • M-x leanote-login ------------ login to server.
  • M-x leanote-sync ------------- sync all notes from server to local.
  • M-x leanote-push ------------- push current note to remote server (include create new).
  • M-x leanote-pull ------------- pull and force update current note from server.
  • M-x leanote-find find -------- all notes in current account(default use swiper).
  • M-x leanote-helm-find -------- find all notes in current account(helm).
  • M-x leanote-delete ----------- delete current note.
  • M-x leanote-rename ----------- rename current note.
  • M-x leanote-notebook-create -- create new notebook.
  • M-x leanote-notebook-delete -- delete current notebook.

Hotkey for action

  • C-x C-l u leanote-push
  • C-x C-l r leanote-rename
  • C-x C-l f leanote-find
  • C-x C-l o leanote-pull
  • C-x C-l n leanote-notebook-create

Leanote status

First of all, install spaceline (need 2.x version), install leanote status by M-x leanote-spaceline-status or add following code to your init file.

(add-hook 'markdown-mode-hook
          (lambda ()
            (leanote)
            (leanote-spaceline-status)  ;; optional, use it if necessary
            ))

The mode line show it status when markdown file is leanote, What's more, when leanote note is modified local (without push to remote), the mode line show leanote* Not login status Already login status Need sync with remote New note status, which need to push to remote

Leanote log

All logs are recorded in *Leanote-Log* buffer.

English version readme ends here. Chinese readme provided as follows.


leanote-mode

leanote-mode是emacs下的一个minor-mode,使得你能在emacs下优雅的记笔记。同时, 可采用leanote提供的服务保存markdown格式的笔记内容。

安装

从elpa的源中进行安装(如melpa 或者 popkit elpa.)

M-x package-install RET leanote RET

手工安装,下载leanote.el文件到文件夹*/path/to/leanote/*

(add-to-list 'load-path "/path/to/leanote/")
(require 'leanote)
(add-hook 'markdown-mode-hook
          (lambda ()
            (leanote)
            (leanote-spaceline-status)  ;; optional, use it if necessary
            ))

使用

将下面代码添加到你emacs的启动文件(.emacs 或者 init.el 或者 .spacemacs)

(add-hook 'markdown-mode-hook 'leanote)

如果你是自己部署leanote的服务,配置自己服务的api

(setq leanote-api-root "https://your-domain/api")

常用功能

  • M-x leanote-login ------------ 登录服务器
  • M-x leanote-sync ------------- 同步所有远端笔记到本地
  • M-x leanote-push ------------- 将当前本地笔记上传到远端(如果远端没有就创建之)
  • M-x leanote-pull ------------- 强制同步当前笔记为远端内容
  • M-x leanote-find ------------- 查找当前账号下所有本地笔记
  • M-x leanote-delete ----------- 删除当前笔记
  • M-x leanote-rename ----------- 重命名当前笔记
  • M-x leanote-notebook-create -- 新建立笔记本
  • M-x leanote-notebook-delete -- 删除当前笔记本

常功能绑定的快捷键

  • C-x C-l u leanote-push
  • C-x C-l r leanote-rename
  • C-x C-l f leanote-find
  • C-x C-l o leanote-pull
  • C-x C-l n leanote-notebook-create

leanote状态显示

leanote状态需要安装2.x及以上版本的spaceline,然后通过M-x leanote-spaceline-status 或者将下列代码加入到你emacs初始配置文件里(这样不用每次打开emacs执行上面命令)。

(add-hook 'markdown-mode-hook
          (lambda ()
            (leanote)
            (leanote-spaceline-status)  ;; optional, use it if necessary
            ))

当一个markdown文件为leanote时,其mode line会显示出来,如下: 当一个leanote文件只是在本地修改了,没有同步到远端的时,状态显示为leanote*,如下: 没有登录时的状态 已经登录时的状态 本地笔记没有远程笔记新时,需要同步远程笔记时的状态 还没有push到远端的新笔记状态

操作日志

所有的操作日志被记录在*Leanote-Log* 这个buffer里。

FAQ

  • 出现Could not create connection to leanote.com:443?
    答:windows下emacs 24.5及以下版本是不支持TLS,要手动安装一个TLS库,见这个博客

About

A minor mode writing markdown note using leanote platform in emacs.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Emacs Lisp 99.2%
  • Makefile 0.8%