Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 382 lines (326 sloc) 11.999 kb
caa728d @nibrahim Initial version. Some code to load up posts
authored
1 ;;; hyde.el
2 ;; Copyright (C) 2004 Noufal Ibrahim <noufal at nibrahim.net.in>
3 ;;
4 ;; This program is not part of Gnu Emacs
5 ;;
6 ;; hyde.el is free software; you can redistribute it and/or modify it
7 ;; under the terms of the GNU General Public License as published by
274a70f @nibrahim Bumps LICENSE to GPLv3 and adds LICENSE and CHANGELOG files
authored
8 ;; the Free Software Foundation; either version 3 of the License, or
caa728d @nibrahim Initial version. Some code to load up posts
authored
9 ;; (at your option) any later version.
10 ;;
11 ;; This program is distributed in the hope that it will be useful, but
12 ;; WITHOUT ANY WARRANTY; without even the implied warranty of
13 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 ;; General Public License for more details.
15 ;;
16 ;; You should have received a copy of the GNU General Public License
17 ;; along with this program; if not, write to the Free Software
18 ;; Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
19 ;; 02111-1307, USA.
20
ee0a681 @nibrahim Basic commands to get statuses of posts working
authored
21 ;; Requirements
22 (require 'hyde-git)
0062e3f @nibrahim Implemented a skeleton hyde-markdown mode and use that for all work t…
authored
23 (require 'hyde-md)
ee0a681 @nibrahim Basic commands to get statuses of posts working
authored
24
95841c1 @nibrahim A few mode map entries
authored
25 ;; Constants for internal use
4ce55da @nibrahim Added group for all the customisable items
authored
26 (defconst hyde/hyde-version "0.2"
7b0e8e4 @nibrahim Got font lock to work right
authored
27 "Hyde version")
28
95841c1 @nibrahim A few mode map entries
authored
29 ;; Internal customisable variables
4ce55da @nibrahim Added group for all the customisable items
authored
30 (defcustom hyde-mode-hook nil
31 "Hook called by \"hyde-mode\""
32 :type 'hook
33 :group 'hyde)
7b0e8e4 @nibrahim Got font lock to work right
authored
34
860c091 @nibrahim Add support for multiple blogs using a config file in the blog directory
authored
35
95841c1 @nibrahim A few mode map entries
authored
36 (defcustom hyde-deploy-dir
37 "_site"
4ce55da @nibrahim Added group for all the customisable items
authored
38 "Directory which needs to be deployed"
39 :type 'string
40 :group 'hyde)
41
caa728d @nibrahim Initial version. Some code to load up posts
authored
42
95841c1 @nibrahim A few mode map entries
authored
43 (defcustom hyde-posts-dir
44 "_posts"
4ce55da @nibrahim Added group for all the customisable items
authored
45 "Directory which contains the list of posts"
46 :type 'string
47 :group 'hyde)
caa728d @nibrahim Initial version. Some code to load up posts
authored
48
9af5e19 @nibrahim Posts are drafts by default now and will be promoted only upon request
authored
49 (defcustom hyde-drafts-dir
50 "_drafts"
4ce55da @nibrahim Added group for all the customisable items
authored
51 "Directory which contains post drafts"
52 :type 'string
53 :group 'hyde)
9af5e19 @nibrahim Posts are drafts by default now and will be promoted only upon request
authored
54
95841c1 @nibrahim A few mode map entries
authored
55 (defcustom hyde/hyde-list-posts-command
56 "/bin/ls -1tr "
4ce55da @nibrahim Added group for all the customisable items
authored
57 "Command to list the posts"
58 :type 'string
59 :group 'hyde)
caa728d @nibrahim Initial version. Some code to load up posts
authored
60
407bea1 @nibrahim Implemeted commit, generate and deploy
authored
61 (defcustom hyde/jekyll-command
a347706 @nibrahim Changed jekyll command
authored
62 "jekyll"
4ce55da @nibrahim Added group for all the customisable items
authored
63 "Command to run jekyll to create the blog"
64 :type 'string
65 :group 'hyde)
407bea1 @nibrahim Implemeted commit, generate and deploy
authored
66
67 (defcustom hyde/deploy-command
68 "rsync -vr _site/* nkv@ssh.hcoop.net:/afs/hcoop.net/user/n/nk/nkv/public_html/nibrahim.net.in/"
4ce55da @nibrahim Added group for all the customisable items
authored
69 "Command used to deploy the site to the actual server"
70 :type 'string
71 :group 'hyde)
407bea1 @nibrahim Implemeted commit, generate and deploy
authored
72
95841c1 @nibrahim A few mode map entries
authored
73 ;; Faces and font-locking
7b0e8e4 @nibrahim Got font lock to work right
authored
74 (defface hyde-header-face
75 '(
cb37e9f @nibrahim A few new faces for the various status types and rudimentary creation…
authored
76 (((type tty) (class color)) (:foreground "blue" :background "gray"))
77 (((type graphic) (class color)) (:foreground "blue" :background "gray"))
78 (t (:foreground "blue" :background "gray"))
7b0e8e4 @nibrahim Got font lock to work right
authored
79 )
4ce55da @nibrahim Added group for all the customisable items
authored
80 "Face for a hyde header"
81 :group 'hyde)
7b0e8e4 @nibrahim Got font lock to work right
authored
82
cb37e9f @nibrahim A few new faces for the various status types and rudimentary creation…
authored
83 (defface hyde-committed-face
84 '(
85 (((type tty) (class color)) (:foreground "blue"))
86 (((type graphic) (class color)) (:foreground "blue"))
87 (t (:foreground "blue"))
88 )
4ce55da @nibrahim Added group for all the customisable items
authored
89 "Face for a file that has been committed"
90 :group 'hyde)
91
cb37e9f @nibrahim A few new faces for the various status types and rudimentary creation…
authored
92
93 (defface hyde-modified-face
94 '(
95 (((type tty) (class color)) (:foreground "red"))
96 (((type graphic) (class color)) (:foreground "red"))
97 (t (:foreground "red"))
98 )
4ce55da @nibrahim Added group for all the customisable items
authored
99 "Face for a file that has been modified but not committed"
100 :group 'hyde)
cb37e9f @nibrahim A few new faces for the various status types and rudimentary creation…
authored
101
102 (defface hyde-unsaved-face
103 '(
104 (((type tty) (class color)) (:foreground "black" :background "red"))
105 (((type graphic) (class color)) (:foreground "black" :background "red"))
106 (t (:foreground "black" :background "red"))
107 )
4ce55da @nibrahim Added group for all the customisable items
authored
108 "Face for a file that has been modified but not even saved"
109 :group 'hyde)
cb37e9f @nibrahim A few new faces for the various status types and rudimentary creation…
authored
110
111 (defface hyde-pushed-face
112 '(
113 (((type tty) (class color)) (:foreground "green"))
114 (((type graphic) (class color)) (:foreground "green"))
115 (t (:foreground "green"))
116 )
4ce55da @nibrahim Added group for all the customisable items
authored
117 "Face for a file that has been pushed to the remote repo"
118 :group 'hyde)
cb37e9f @nibrahim A few new faces for the various status types and rudimentary creation…
authored
119
7b0e8e4 @nibrahim Got font lock to work right
authored
120 (defvar hyde-header-face 'hyde-header-face "Face for a hyde header")
cb37e9f @nibrahim A few new faces for the various status types and rudimentary creation…
authored
121 (defvar hyde-committed-face 'hyde-committed-face)
122 (defvar hyde-modified-face 'hyde-modified-face)
123 (defvar hyde-unsaved-face 'hyde-unsaved-face )
124 (defvar hyde-pushed-face 'hyde-pushed-face)
7b0e8e4 @nibrahim Got font lock to work right
authored
125
126 (defconst hyde-font-lock-keywords
127 (list
128 '("^::.*" . hyde-header-face)
cb37e9f @nibrahim A few new faces for the various status types and rudimentary creation…
authored
129 '("^C :.*" . hyde-committed-face)
130 '("^M :.*" . hyde-modified-face)
131 '("^E :.*" . hyde-unsaved-face)
132 '("^\\. :.*" . hyde-pushed-face)
7b0e8e4 @nibrahim Got font lock to work right
authored
133 )
134 "Font lock keywords for Hyde mode")
caa728d @nibrahim Initial version. Some code to load up posts
authored
135
ee0a681 @nibrahim Basic commands to get statuses of posts working
authored
136 ;; Version control abstraction
137 (defalias 'hyde/vc-uncommittedp 'hyde/git/uncommittedp "Command to check whether a file has uncommitted changes")
138 (defalias 'hyde/vc-unpushedp 'hyde/git/unpushedp "Command to check whether a file has unpushed changes")
9af5e19 @nibrahim Posts are drafts by default now and will be promoted only upon request
authored
139 (defalias 'hyde/vc-pushedp 'hyde/git/pushedp "Command to check whether a file has pushed changes")
407bea1 @nibrahim Implemeted commit, generate and deploy
authored
140 (defalias 'hyde/vc-add 'hyde/git/add "Command to add a file to the DVCS")
141 (defalias 'hyde/vc-commit 'hyde/git/commit "Command to add a file to the DVCS")
142 (defalias 'hyde/vc-push 'hyde/git/push "Command to push the repository")
9af5e19 @nibrahim Posts are drafts by default now and will be promoted only upon request
authored
143 (defalias 'hyde/vc-rename 'hyde/git/rename "Command to push the repository")
ee0a681 @nibrahim Basic commands to get statuses of posts working
authored
144
9af5e19 @nibrahim Posts are drafts by default now and will be promoted only upon request
authored
145 (defun hyde/hyde-file-local-uncommitted-changed (dir file)
1633403 @nibrahim Added docstrings to all functions
authored
146 "Return whether the given file in the given dir is uncommitted"
9af5e19 @nibrahim Posts are drafts by default now and will be promoted only upon request
authored
147 (hyde/vc-uncommittedp (concat hyde-home "/" dir) file))
ee0a681 @nibrahim Basic commands to get statuses of posts working
authored
148
9af5e19 @nibrahim Posts are drafts by default now and will be promoted only upon request
authored
149 (defun hyde/hyde-file-committed-not-pushed (dir file)
1633403 @nibrahim Added docstrings to all functions
authored
150 "Return whether the given file in the given dir is unpushed"
9af5e19 @nibrahim Posts are drafts by default now and will be promoted only upon request
authored
151 (hyde/vc-unpushedp (concat hyde-home "/" dir) file))
ee0a681 @nibrahim Basic commands to get statuses of posts working
authored
152
9af5e19 @nibrahim Posts are drafts by default now and will be promoted only upon request
authored
153 (defun hyde/hyde-file-committed-pushed (dir file)
1633403 @nibrahim Added docstrings to all functions
authored
154 "Return whether the given file in the given dir is pushed"
9af5e19 @nibrahim Posts are drafts by default now and will be promoted only upon request
authored
155 (hyde/vc-pushedp (concat hyde-home "/" dir) file))
ee0a681 @nibrahim Basic commands to get statuses of posts working
authored
156
407bea1 @nibrahim Implemeted commit, generate and deploy
authored
157 (defun hyde/hyde-add-file (file)
1633403 @nibrahim Added docstrings to all functions
authored
158 "Stages the given file for commit."
407bea1 @nibrahim Implemeted commit, generate and deploy
authored
159 (hyde/vc-add (concat hyde-home "/" hyde-posts-dir) file))
160
9af5e19 @nibrahim Posts are drafts by default now and will be promoted only upon request
authored
161 (defun hyde/hyde-rename-file (from to)
1633403 @nibrahim Added docstrings to all functions
authored
162 "Renames the given file from to to"
9af5e19 @nibrahim Posts are drafts by default now and will be promoted only upon request
authored
163 (hyde/vc-rename hyde-home from to))
164
165 (defun hyde/hyde-commit-post (pos commit-message)
1633403 @nibrahim Added docstrings to all functions
authored
166 "Commits the changes in the repository"
407bea1 @nibrahim Implemeted commit, generate and deploy
authored
167 (interactive "d\nMCommit message : ")
168 (let (
169 (post-file-name (nth
170 1
9af5e19 @nibrahim Posts are drafts by default now and will be promoted only upon request
authored
171 (split-string (strip-string (thing-at-point 'line)) " : ")))
172 (dir (get-text-property pos 'dir)))
173 (hyde/vc-commit (concat hyde-home "/" dir) post-file-name commit-message)
407bea1 @nibrahim Implemeted commit, generate and deploy
authored
174 (hyde/load-posts)))
ee0a681 @nibrahim Basic commands to get statuses of posts working
authored
175
407bea1 @nibrahim Implemeted commit, generate and deploy
authored
176 (defun hyde/hyde-push ()
1633403 @nibrahim Added docstrings to all functions
authored
177 "Publishes the changes to the remote repository"
407bea1 @nibrahim Implemeted commit, generate and deploy
authored
178 (interactive)
179 (hyde/vc-push hyde-home)
180 (hyde/load-posts))
181
182 (defun hyde/run-jekyll ()
1633403 @nibrahim Added docstrings to all functions
authored
183 "Runs jekyll on the directory"
407bea1 @nibrahim Implemeted commit, generate and deploy
authored
184 (interactive)
185 (shell-command (format "cd %s && %s" hyde-home hyde/jekyll-command)))
186
187 (defun hyde/deploy ()
1633403 @nibrahim Added docstrings to all functions
authored
188 "Deploys the generated website (should be run after hyde/run-jekyll"
407bea1 @nibrahim Implemeted commit, generate and deploy
authored
189 (interactive)
190 (shell-command (format "cd %s && %s" hyde-home hyde/deploy-command)))
191
192
95841c1 @nibrahim A few mode map entries
authored
193 ;; Utility functions
9af5e19 @nibrahim Posts are drafts by default now and will be promoted only upon request
authored
194 (defun hyde/hyde-file-local-unsaved-changed (dir file)
eab5334 @nibrahim Delayed commit. Verified the statuses working for files in different …
authored
195 "Returns true if and only if the given file contains unsaved changes"
196 (let (
197 (buffer (get-file-buffer file))
198 )
199 (if buffer
200 (buffer-modified-p buffer)
201 nil)))
202
203 (defun strip-string (str)
204 "Returns STR with all trailing whitespaces gone"
205 (replace-regexp-in-string "\n$" "" str))
206
9af5e19 @nibrahim Posts are drafts by default now and will be promoted only upon request
authored
207 (defun hyde/file-status (dir file)
eab5334 @nibrahim Delayed commit. Verified the statuses working for files in different …
authored
208 "Returns an letter indicating the status of the file as far as
209 hyde is concerned
210
cb37e9f @nibrahim A few new faces for the various status types and rudimentary creation…
authored
211 Committed means that the changes have been committed into your DVCS
212 Pushed out means that they have been pushed to a safe remote repo (github, bitbucket etc.)
eab5334 @nibrahim Delayed commit. Verified the statuses working for files in different …
authored
213
cb37e9f @nibrahim A few new faces for the various status types and rudimentary creation…
authored
214 Status indicators are as follows:
eab5334 @nibrahim Delayed commit. Verified the statuses working for files in different …
authored
215
cb37e9f @nibrahim A few new faces for the various status types and rudimentary creation…
authored
216 . Committed and pushed
217 C Committed but not yet pushed
218 M Local saved changes (uncommitted)
219 E Local unsaved changes"
eab5334 @nibrahim Delayed commit. Verified the statuses working for files in different …
authored
220 (or
9af5e19 @nibrahim Posts are drafts by default now and will be promoted only upon request
authored
221 (and (hyde/hyde-file-local-unsaved-changed dir file) "E")
222 (and (hyde/hyde-file-local-uncommitted-changed dir file) "M")
223 (and (hyde/hyde-file-committed-not-pushed dir file) "C")
224 (and (hyde/hyde-file-committed-pushed dir file) ".")))
eab5334 @nibrahim Delayed commit. Verified the statuses working for files in different …
authored
225
226
9af5e19 @nibrahim Posts are drafts by default now and will be promoted only upon request
authored
227 (defun hyde/list-format-posts (dir)
228 "Gets the lists of posts from the given directory, formats them
eab5334 @nibrahim Delayed commit. Verified the statuses working for files in different …
authored
229 properly and returns them so that they can be presented to the
230 user"
231 (let (
232 (posts (split-string (strip-string (shell-command-to-string
9af5e19 @nibrahim Posts are drafts by default now and will be promoted only upon request
authored
233 (concat "cd " hyde-home "/" dir " ; " hyde/hyde-list-posts-command ))))))
234 (map 'list (lambda (f) (format "%s : %s" (hyde/file-status dir f) f)) posts)))
eab5334 @nibrahim Delayed commit. Verified the statuses working for files in different …
authored
235
9af5e19 @nibrahim Posts are drafts by default now and will be promoted only upon request
authored
236 (defun hyde/promote-to-post (pos)
1633403 @nibrahim Added docstrings to all functions
authored
237 "Promotes the post under the cursor from a draft to a post"
9af5e19 @nibrahim Posts are drafts by default now and will be promoted only upon request
authored
238 (interactive "d")
239 (let (
240 (post-file-name (nth
241 1
242 (split-string (strip-string (thing-at-point 'line)) " : ")))
243 (dir (get-text-property pos 'dir)))
244 (if (equal dir hyde-drafts-dir)
245 (hyde/hyde-rename-file (concat dir "/" post-file-name)
246 (concat hyde-posts-dir "/" post-file-name)))
247 (hyde/load-posts)))
eab5334 @nibrahim Delayed commit. Verified the statuses working for files in different …
authored
248
7b0e8e4 @nibrahim Got font lock to work right
authored
249
ee0a681 @nibrahim Basic commands to get statuses of posts working
authored
250 (defun hyde/open-post-maybe (pos)
1633403 @nibrahim Added docstrings to all functions
authored
251 "Opens the post under cursor in the editor"
ee0a681 @nibrahim Basic commands to get statuses of posts working
authored
252 (interactive "d")
253 (let (
1bcd7dc @nibrahim Small fix to open the right file name
authored
254 (post-file-name (nth
255 1
9af5e19 @nibrahim Posts are drafts by default now and will be promoted only upon request
authored
256 (split-string (strip-string (thing-at-point 'line)) " : ")))
257 (dir (get-text-property pos 'dir)))
1bcd7dc @nibrahim Small fix to open the right file name
authored
258 (find-file
9af5e19 @nibrahim Posts are drafts by default now and will be promoted only upon request
authored
259 (strip-string (concat hyde-home "/" dir "/" post-file-name)))
0062e3f @nibrahim Implemented a skeleton hyde-markdown mode and use that for all work t…
authored
260 (hyde-markdown-mode)))
95841c1 @nibrahim A few mode map entries
authored
261
cb37e9f @nibrahim A few new faces for the various status types and rudimentary creation…
authored
262 (defun hyde/new-post (title)
1633403 @nibrahim Added docstrings to all functions
authored
263 "Creates a new post"
cb37e9f @nibrahim A few new faces for the various status types and rudimentary creation…
authored
264 (interactive "MEnter post title: ")
265 (let ((post-file-name (format "%s/%s/%s.markdown"
9af5e19 @nibrahim Posts are drafts by default now and will be promoted only upon request
authored
266 hyde-home hyde-drafts-dir (concat
cb37e9f @nibrahim A few new faces for the various status types and rudimentary creation…
authored
267 (format-time-string "%Y-%m-%d-")
268 (downcase (replace-regexp-in-string " " "_" title))))))
269
181f9d2 @nibrahim Made hyde-home buffer local to handle multiple blogs and fixed new bugs
authored
270 (save-excursion
271 (find-file post-file-name)
272 (insert "---\n")
273 (insert "layout: post\n")
274 (insert (format "title: \"%s\"\n" title))
275 (insert "---\n\n")
276 (save-buffer))
407bea1 @nibrahim Implemeted commit, generate and deploy
authored
277 (hyde/hyde-add-file post-file-name)
181f9d2 @nibrahim Made hyde-home buffer local to handle multiple blogs and fixed new bugs
authored
278 (find-file post-file-name)
279
280 ;; hyde-home not available in markdown buffer (FIXME)
cb37e9f @nibrahim A few new faces for the various status types and rudimentary creation…
authored
281 (hyde-markdown-mode)))
282
fdeec3a @nibrahim Added quit as a function to hyde
authored
283 (defun hyde/quit ()
284 "Quits hyde"
1633403 @nibrahim Added docstrings to all functions
authored
285 (interactive)
fdeec3a @nibrahim Added quit as a function to hyde
authored
286 (kill-buffer (current-buffer)))
287
288
95841c1 @nibrahim A few mode map entries
authored
289 ;; Keymaps
290 (defvar hyde-mode-map
291 (let
292 ((hyde-mode-map (make-sparse-keymap)))
cb37e9f @nibrahim A few new faces for the various status types and rudimentary creation…
authored
293 (define-key hyde-mode-map (kbd "n") 'hyde/new-post)
407bea1 @nibrahim Implemeted commit, generate and deploy
authored
294 (define-key hyde-mode-map (kbd "g") 'hyde/load-posts)
295 (define-key hyde-mode-map (kbd "c") 'hyde/hyde-commit-post)
9af5e19 @nibrahim Posts are drafts by default now and will be promoted only upon request
authored
296 (define-key hyde-mode-map (kbd "P") 'hyde/hyde-push)
407bea1 @nibrahim Implemeted commit, generate and deploy
authored
297 (define-key hyde-mode-map (kbd "j") 'hyde/run-jekyll)
298 (define-key hyde-mode-map (kbd "d") 'hyde/deploy)
9af5e19 @nibrahim Posts are drafts by default now and will be promoted only upon request
authored
299 (define-key hyde-mode-map (kbd "p") 'hyde/promote-to-post)
fdeec3a @nibrahim Added quit as a function to hyde
authored
300 (define-key hyde-mode-map (kbd "q") 'hyde/quit)
ee0a681 @nibrahim Basic commands to get statuses of posts working
authored
301 (define-key hyde-mode-map (kbd "RET") 'hyde/open-post-maybe)
95841c1 @nibrahim A few mode map entries
authored
302 hyde-mode-map)
303 "Keymap for Hyde")
304
9af5e19 @nibrahim Posts are drafts by default now and will be promoted only upon request
authored
305
cb37e9f @nibrahim A few new faces for the various status types and rudimentary creation…
authored
306 (defun hyde/load-posts ()
307 "Load up the posts and present them to the user"
407bea1 @nibrahim Implemeted commit, generate and deploy
authored
308 (interactive)
cb37e9f @nibrahim A few new faces for the various status types and rudimentary creation…
authored
309 ;; Clear the buffer
310 (toggle-read-only -1)
311 (delete-region (point-min) (point-max))
312 ;; Insert headers
313 (insert ":: Editing blog at:" hyde-home "\n")
9af5e19 @nibrahim Posts are drafts by default now and will be promoted only upon request
authored
314 (insert ":: Posts\n")
315 ;; Insert posts from posts directory
316 (let
317 ((posts (hyde/list-format-posts hyde-posts-dir)))
318 (dolist (post posts)
319 (progn
320 (save-excursion
321 (insert (concat post "\n")))
322 (put-text-property (point) (+ (point) (length post)) 'dir hyde-posts-dir)
323 (forward-line))))
324 (insert "\n:: Drafts\n")
cb37e9f @nibrahim A few new faces for the various status types and rudimentary creation…
authored
325 (let
9af5e19 @nibrahim Posts are drafts by default now and will be promoted only upon request
authored
326 ((posts (hyde/list-format-posts hyde-drafts-dir)))
cb37e9f @nibrahim A few new faces for the various status types and rudimentary creation…
authored
327 (dolist (post posts)
9af5e19 @nibrahim Posts are drafts by default now and will be promoted only upon request
authored
328 (progn
329 (save-excursion
330 (insert (concat post "\n")))
331 (put-text-property (point) (+ (point) (length post)) 'dir hyde-drafts-dir)
332 (forward-line))))
cb37e9f @nibrahim A few new faces for the various status types and rudimentary creation…
authored
333 ;; Insert footer
9af5e19 @nibrahim Posts are drafts by default now and will be promoted only upon request
authored
334 (insert (concat "\n\n:: Hyde version " hyde/hyde-version "\n"))
407bea1 @nibrahim Implemeted commit, generate and deploy
authored
335 (insert "Key:\n-----\n . Committed and pushed\n C Committed but not yet pushed\n M Local saved changes (uncommitted)\n E Local unsaved changes\n")
9af5e19 @nibrahim Posts are drafts by default now and will be promoted only upon request
authored
336 (toggle-read-only 1))
95841c1 @nibrahim A few mode map entries
authored
337
181f9d2 @nibrahim Made hyde-home buffer local to handle multiple blogs and fixed new bugs
authored
338 (defun hyde/read-config (hyde-home)
d6fa1a6 @nibrahim Adds interactive prompt for hyde-home and config reader
authored
339 "Loads up the config file to set the blog deployment and other information"
340 (let (
341 (config-file (concat hyde-home "/.hyde.el"))
342 )
860c091 @nibrahim Add support for multiple blogs using a config file in the blog directory
authored
343 (message (format "Loading %s" config-file))
d6fa1a6 @nibrahim Adds interactive prompt for hyde-home and config reader
authored
344 (load-file config-file)
345 ))
346
347
181f9d2 @nibrahim Made hyde-home buffer local to handle multiple blogs and fixed new bugs
authored
348 (defun hyde/hyde-mode (home)
cb37e9f @nibrahim A few new faces for the various status types and rudimentary creation…
authored
349 "The Hyde major mode to edit Jekyll posts."
7b0e8e4 @nibrahim Got font lock to work right
authored
350 (kill-all-local-variables)
181f9d2 @nibrahim Made hyde-home buffer local to handle multiple blogs and fixed new bugs
authored
351 (dolist (x '(hyde-deploy-dir
860c091 @nibrahim Add support for multiple blogs using a config file in the blog directory
authored
352 hyde-posts-dir
353 hyde-drafts-dir
354 hyde/hyde-list-posts-command
355 hyde/jekyll-command
356 hyde/deploy-command
357 hyde/git/remote
358 hyde/git/remote-branch))
359 (make-variable-buffer-local x))
181f9d2 @nibrahim Made hyde-home buffer local to handle multiple blogs and fixed new bugs
authored
360 (set (make-local-variable 'hyde-home) home)
7b0e8e4 @nibrahim Got font lock to work right
authored
361 (use-local-map hyde-mode-map)
362 (set (make-local-variable 'font-lock-defaults) '(hyde-font-lock-keywords))
95841c1 @nibrahim A few mode map entries
authored
363 (setq major-mode 'hyde/hyde-mode
860c091 @nibrahim Add support for multiple blogs using a config file in the blog directory
authored
364 mode-name "Hyde")
181f9d2 @nibrahim Made hyde-home buffer local to handle multiple blogs and fixed new bugs
authored
365 (hyde/read-config hyde-home)
860c091 @nibrahim Add support for multiple blogs using a config file in the blog directory
authored
366 (hyde/load-posts)
367 (hl-line-mode t)
368 (run-hooks hyde-mode-hook))
369
95841c1 @nibrahim A few mode map entries
authored
370
371 ;; Entry point
181f9d2 @nibrahim Made hyde-home buffer local to handle multiple blogs and fixed new bugs
authored
372 (defun hyde (home)
caa728d @nibrahim Initial version. Some code to load up posts
authored
373 "Enters hyde mode"
860c091 @nibrahim Add support for multiple blogs using a config file in the blog directory
authored
374 (interactive "DBlog : ")
d6fa1a6 @nibrahim Adds interactive prompt for hyde-home and config reader
authored
375 (let (
181f9d2 @nibrahim Made hyde-home buffer local to handle multiple blogs and fixed new bugs
authored
376 (hyde-buffer (concat "*Hyde : " home "*"))
d6fa1a6 @nibrahim Adds interactive prompt for hyde-home and config reader
authored
377 )
860c091 @nibrahim Add support for multiple blogs using a config file in the blog directory
authored
378 (switch-to-buffer (get-buffer-create hyde-buffer)))
181f9d2 @nibrahim Made hyde-home buffer local to handle multiple blogs and fixed new bugs
authored
379 (hyde/hyde-mode home))
860c091 @nibrahim Add support for multiple blogs using a config file in the blog directory
authored
380
caa728d @nibrahim Initial version. Some code to load up posts
authored
381 (provide 'hyde)
Something went wrong with that request. Please try again.