Closed limist closed 11 years ago
If you want to change the filename scheme, you can create your own filename-sanitizer function.
is that what you want?
@renard Thanks - what I'm looking for is guidance on where to put a function like a custom filename-sanitizer function. I didn't see any mention in the docs/tips as to where the code for such functions should reside.
Right now what I'm using is a file called o-blog-customizations.el
that is called in the mapchar
and require
expression in o-blog.el
as a temporary approach until someone suggests a better way. :)
If this is for private usage you can put it wherever your like to :-). In that way you may dans to require them in your emacs configuration file such as:
(eval-after-load 'o-blog
`(progn
(require 'my-customization)))
If this may be useful for other people please share.
@renard So to check my understanding: custom functions could and should go in my Emacs configuration file? And within my config file, I can either use a require
to load an external library, or define the function there?
What would be helpful is a full example. Suppose I have this function I want to use:
(defun custom-set-filepath-to-category (category year month)
(format "%s" category))
Then in my o-blog file I'd have #+POSTS_FILEPATH: custom-set-filepath-to-category
And then in my emacs config file, what should be there?
BTW, I'll gladly add documentation on this in the sample.org
file. :)
Hi limist,
I know I'm a month late but just in case you're still musing... I am using https://github.com/jwiegley/use-package for my emacs config needs and enjoying it. Here's my current o-blog setup:
(use-package o-blog
:commands (o-blog-publish
o-blog-tangle-publish-and-view)
:config
(progn
(defvar o-blog-local-site "~/Sites/dev")
(defvar o-blog-out-dir "out")
(defvar o-blog-local-url-index "http://127.0.0.1/~username/dev/index.html")
(defun o-blog-publish ()
(interactive)
"publish blog locally"
(org-publish-blog buffer-file-name)
(if (file-exists-p o-blog-local-site)
(delete-directory o-blog-local-site t))
(copy-directory
(format "%s%s" default-directory o-blog-out-dir) o-blog-local-site))
(defun o-blog-tangle-publish-and-view ()
(interactive)
"tangle template and style files in current buffer, publish blog locally
and view local index.html url"
(org-babel-tangle-file buffer-file-name)
(o-blog-publish)
(browse-url o-blog-local-url-index)))
:bind (("C-c C-v ," . o-blog-publish)
("C-c C-v ." . o-blog-tangle-publish-and-view)))
@tonyday567 Very cool and helpful package, thanks for your comment! This approach beats the kludge I'm using, will write it up for the o-blog documentation, unless you want to do so.
very welcome to write it up. Though putting the templates in the same org file and tangling them isn't the standard way people do these things, so you might like to note that.
In order to customize some important aspects of posts, like the URL, it's necessary to have custom functions; where should such functions be defined? Hope this isn't RTFM, but I couldn't find directions on this, even the lengthy customization discussion in https://github.com/renard/o-blog/issues/24 didn't mention where custom functions should go.
I'd rather not "pollute" the main
o-blog.el
file with such customization, so perhaps the solution is a file likeo-blog-custom.el
that will be pulled in viarequire
. Or is there a better way?