X-Git-Url: https://git.korewanetadesu.com/?p=pelican-mode.git;a=blobdiff_plain;f=pelican-mode.el;h=893fc2901245d7ef45b36e8ab619f917849ea330;hp=2c8315b8b47ef0b00d87a1d13c6b680d71bbb8a0;hb=0eeee74fd9a459dd8c04c264c183d80f2d2b98b2;hpb=10f08901a68593cb72c94339505ca2d6b6dfe031 diff --git a/pelican-mode.el b/pelican-mode.el index 2c8315b..893fc29 100644 --- a/pelican-mode.el +++ b/pelican-mode.el @@ -5,6 +5,7 @@ ;; Author: Joe Wreschnig ;; Package-Version: 20170807 ;; Package-Requires: ((emacs "25")) +;; URL: https://git.korewanetadesu.com/pelican-mode.git ;; Keywords: convenience, editing ;; ;; This program is free software; you can redistribute it and/or modify @@ -24,8 +25,8 @@ ;;; Commentary: ;; -;; pelican-mode is an Emacs minor mode for editing pages and posts in -;; Pelican sites. Pelican is a static site generator which can +;; pelican-mode is an Emacs minor mode for editing articles and pages +;; in Pelican sites. Pelican is a static site generator which can ;; process a variety of text file formats. For more information, see ;; URL https://blog.getpelican.com/. ;; @@ -57,8 +58,72 @@ (require 'seq) (require 'subr-x) +;; Customizations + +(defgroup pelican-mode nil + "Support for Pelican articles and pages. + +For more information about Pelican see URL https://blog.getpelican.com/." + :group 'convenience) + +(defcustom pelican-mode-keymap-prefix (kbd "C-c P") + "Pelican mode keymap prefix." + :group 'pelican-mode + :type 'string) + +(defcustom pelican-mode-default-page-fields + '(:slug slug) + "Fields to include when creating a new page. + +See the documentation for `pelican-mode-set-field' for more information +about metadata fields and special values." + :group 'pelican-mode + :type '(plist)) + +(defcustom pelican-mode-default-article-fields + '(:date now :status "draft" :slug slug) + "Fields to include when creating a new article. + +See the documentation for `pelican-mode-set-field' for more information +about metadata fields and special values." + :group 'pelican-mode + :type '(plist)) + +(defcustom pelican-mode-formats + '((adoc-mode . pelican-mode-set-field-adoc-mode) + (markdown-mode . pelican-mode-set-field-markdown-mode) + (org-mode . pelican-mode-set-field-org-mode) + (rst-mode . pelican-mode-set-field-rst-mode)) + "Functions to handle setting metadata, based on major mode. + +This association list maps modes to functions that take two +arguments, field and value strings." + :group 'pelican-mode + :type '(alist :key-type function :value-type function)) + + + ;; Mode Definition +(defvar pelican-mode-command-map + (let ((map (make-sparse-keymap))) + (define-key map (kbd "d") #'pelican-mode-update-date) + (define-key map (kbd "f") #'pelican-mode-set-field) + (define-key map (kbd "h") #'pelican-make-html) + (define-key map (kbd "n") #'pelican-mode-insert-header) + (define-key map (kbd "p") #'pelican-mode-publish) + (define-key map (kbd "u") #'pelican-make-rsync-upload) + map) + "Keymap for Pelican commands after `pelican-mode-keymap-prefix'.") +(fset 'pelican-mode-command-map pelican-mode-command-map) + +(defvar pelican-mode-map + (let ((map (make-sparse-keymap))) + (define-key map pelican-mode-keymap-prefix + 'pelican-mode-command-map) + map) + "Keymap for Pelican mode.") + ;;;###autoload (define-minor-mode pelican-mode "Toggle Pelican mode. @@ -77,13 +142,8 @@ When Pelican mode is enabled, additional commands are available for editing articles or pages: \\{pelican-mode-map}" - :lighter " Pelican" - :keymap `((,(kbd "C-c P d") . pelican-mode-update-date) - (,(kbd "C-c P f") . pelican-set-field) - (,(kbd "C-c P h") . pelican-make-html) - (,(kbd "C-c P n") . pelican-mode-insert-header) - (,(kbd "C-c P p") . pelican-mode-publish) - (,(kbd "C-c P u") . pelican-make-rsync-upload))) + :keymap pelican-mode-map + :lighter " Pelican") ;;;###autoload (define-minor-mode pelican-global-mode @@ -120,46 +180,6 @@ in an ancestor directory." -;; Customizations - -(defgroup pelican-mode nil - "Support for Pelican articles and pages. - -For more information about Pelican see URL https://blog.getpelican.com/." - :group 'convenience) - -(defcustom pelican-mode-default-page-fields - '(:slug slug) - "Fields to include when creating a new page. - -See the documentation for `pelican-mode-set-field' for more information -about metadata fields and special values." - :group 'pelican-mode - :type '(plist)) - -(defcustom pelican-mode-default-article-fields - '(:date now :status "draft" :slug slug) - "Fields to include when creating a new article. - -See the documentation for `pelican-mode-set-field' for more information -about metadata fields and special values." - :group 'pelican-mode - :type '(plist)) - -(defcustom pelican-mode-formats - '((adoc-mode . pelican-mode-set-field-adoc-mode) - (markdown-mode . pelican-mode-set-field-markdown-mode) - (org-mode . pelican-mode-set-field-org-mode) - (rst-mode . pelican-mode-set-field-rst-mode)) - "Functions to handle setting metadata, based on major mode. - -This association list maps modes to functions that take two -arguments, field and value strings." - :group 'pelican-mode - :type '(alist :key-type function :value-type function)) - - - ;; User Commands (defun pelican-mode-set-field (field value)