Skip to content
Browse files

A few mode map entries

  • Loading branch information...
1 parent 7b0e8e4 commit 95841c150de0ac8e1b0ba7c4b443d1185329609b @nibrahim committed Nov 10, 2010
Showing with 42 additions and 36 deletions.
  1. +42 −36 hyde.el
View
78 hyde.el
@@ -18,49 +18,36 @@
;; Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
;; 02111-1307, USA.
+;; Constants for internal use
(defconst hyde/hyde-version "0.1"
"Hyde version")
+;; Internal customisable variables
(defvar hyde-mode-hook nil
"Hook called by \"hyde-mode\"")
+(defcustom hyde-home
+ "/home/noufal/blog"
+ "Root directory where your entire blog resides")
-(defvar hyde-mode-map
- (let
- ((hyde-mode-map (make-keymap)))
- ;; (define-key hyde-mode-map "\C-j" 'newline-and-indent)
- hyde-mode-map)
- "Keymap for Cisco router configuration major mode")
-
-;; (defcustom hyde-home
-;; "/home/noufal/blog"
-;; "Root directory where your entire blog resides")
-
-(setq hyde-home "/home/noufal/blog")
-
-;; (defcustom hyde-deploy-dir
-;; "_site"
-;; "Directory which needs to be deployed")
+(defcustom hyde-deploy-dir
+ "_site"
+ "Directory which needs to be deployed")
-(setq hyde-deploy-dir "_site")
+(defcustom hyde-posts-dir
+ "_posts"
+ "Directory which contains the list of posts")
-;; (defcustom hyde-posts-dir
-;; "_posts"
-;; "Directory which contains the list of posts")
-
-(setq hyde-posts-dir "_posts")
-
-;; (defcustom hyde/hyde-list-posts-command
-;; "/bin/ls -1tr /tmp"
-;; "Command to list the posts")
-
-(setq hyde/hyde-list-posts-command "/bin/ls -1tr")
+(defcustom hyde/hyde-list-posts-command
+ "/bin/ls -1tr "
+ "Command to list the posts")
+;; Faces and font-locking
(defface hyde-header-face
'(
- (((type tty) (class color)) (:foreground "blue" :weight 'bold))
- (((type graphic) (class color)) (:foreground "lightsteelblue" :weight 'bold))
- (t (:foreground "lightsteelblue" :weight "bold"))
+ (((type tty) (class color)) (:foreground "blue" ))
+ (((type graphic) (class color)) (:foreground "blue" ))
+ (t (:foreground "blue" ))
)
"Face for a hyde header")
@@ -71,11 +58,10 @@
'("^::.*" . hyde-header-face)
)
"Font lock keywords for Hyde mode")
-
+;; Utility functions
(defun hyde/load-posts ()
"Load up the posts and present them to the user"
- (interactive)
;; Insert headers
(insert ":: Editing blog at:" hyde-home "\n")
;; Insert posts
@@ -88,22 +74,42 @@
;; Insert footer
(insert (concat ":: Hyde version " hyde/hyde-version "\n"))))
+;; (defun hyde/open-post-maybe (pos)
+
+
+
+;; Keymaps
+(defvar hyde-mode-map
+ (let
+ ((hyde-mode-map (make-sparse-keymap)))
+ (define-key hyde-mode-map (kbd "n") 'next-line)
+ (define-key hyde-mode-map (kbd "p") 'previous-line)
+ (define-key hyde-mode-map (kbd "C-j") 'hyde/open-post-maybe)
+ hyde-mode-map)
+ "Keymap for Hyde")
+
+
+
(defun hyde/hyde-mode ()
"The Hyde major mode to edit Jekyll posts. I love how that sounds :)"
- (interactive)
(kill-all-local-variables)
(use-local-map hyde-mode-map)
(set (make-local-variable 'font-lock-defaults) '(hyde-font-lock-keywords))
- (setq major-mode 'hyde-mode
+ (setq major-mode 'hyde/hyde-mode
mode-name "Hyde")
(run-hooks hyde-mode-hook))
+
+;; Entry point
(defun hyde ()
"Enters hyde mode"
(interactive)
(switch-to-buffer (get-buffer-create "*Hyde*"))
(hyde/hyde-mode)
- (hyde/load-posts))
+ (hyde/load-posts)
+ (toggle-read-only 1))
(provide 'hyde)
+
+(local-set-key "n" 'self-insert-command)

0 comments on commit 95841c1

Please sign in to comment.
Something went wrong with that request. Please try again.