This patchset brings some shameless self-promotion by adding a byline to
the bottom of a post: "Posted via: SXEmacs/LJ (version string)". It is in
a fairly small font and out of the way so should be reasonably
inconspicuous, but you can turn it off if you want to with...
(setq lj-self-promote nil)
There's a new user variable, `lj-signature', the value of which is
inserted at the bottom of the post buffer if it is non-nil. It is
inserted verbatim, so making it pretty (HTML formatting) is up to the
user.
* lj.el (lj-byline): New. Nothing wrong with a bit of
self-advertising, I reckon. ;-)
* lj.el (lj-self-promote): New. When non-nil tell the world that
you use sexy software.
* lj.el (lj-post): Optionally add the byline.
* lj.el (lj-preview): Include byline in preview.
* lj.el (lj-validate): Ditto.
* lj.el (lj-signature): New. Lets you include a sig at the bottom
of a post.
* lj.el (lj-generate-new-buffer): Insert the signature if it is set.
* lj.el (lj-version): Bump.
Signed-off-by: Steve Youngs <steve@sxemacs.org>
;; lj.el --- LiveJournal meets SXEmacs -*- Emacs-Lisp -*-
;; lj.el --- LiveJournal meets SXEmacs -*- Emacs-Lisp -*-
-;; Copyright (C) 2008, 2009 Steve Youngs
+;; Copyright (C) 2008 - 2011 Steve Youngs
;; Author: Steve Youngs <steve@sxemacs.org>
;; Maintainer: Steve Youngs <steve@sxemacs.org>
;; Created: <2008-06-15>
;; Based On: jwz-lj.el by Jamie Zawinski <jwz@jwz.org>
;; Keywords: blog, lj, livejournal
;; Author: Steve Youngs <steve@sxemacs.org>
;; Maintainer: Steve Youngs <steve@sxemacs.org>
;; Created: <2008-06-15>
;; Based On: jwz-lj.el by Jamie Zawinski <jwz@jwz.org>
;; Keywords: blog, lj, livejournal
-;; Homepage: <http://www.sxemacs.org/~steve/lj/lj.el>
+;; Homepage: <http://www.sxemacs.org/lj.el>
;; This file is part of SLH (Steve's Lisp Hacks).
;; This file is part of SLH (Steve's Lisp Hacks).
;; certain. As for GNU/Emacs... absolutely no idea, but I'd doubt
;; that this is anywhere near compatible.
;;
;; certain. As for GNU/Emacs... absolutely no idea, but I'd doubt
;; that this is anywhere near compatible.
;;
-;;; History:
-;;
-;; See the tla logs
-;;
-(defconst lj-version 1.25
+(defconst lj-version 1.26
"Version number of SXEmacs/LJ.")
;;; Code:
"Version number of SXEmacs/LJ.")
;;; Code:
(interactive)
(customize-group "lj"))
(interactive)
(customize-group "lj"))
+(defcustom lj-self-promote t
+ "When non-nil, a \"Posted via...\" byline is added to a post.
+
+The text is a single line in small print (8pt) right justified at the
+very end of your post. It should be quite inconspicuous, but you are
+welcome to turn this off if you are too bashful to let the world know
+what software you use."
+ :type 'boolean
+ :group 'lj)
+
(defcustom lj-user-id (user-login-name)
"*Your LJ user ID."
:type 'string
:group 'lj)
(defcustom lj-user-id (user-login-name)
"*Your LJ user ID."
:type 'string
:group 'lj)
+(defcustom lj-signature nil
+ "A signature to add to the bottom of a post.
+
+This is analogous to an email signature. Set this any HTML marked up
+text you like, or something that returns such. Remember to use valid
+XHTML 1.0 Transitional if you plan to validate before posting."
+ :type 'sexp
+ :group 'lj)
+
(defcustom lj-cookie-flavour 'auto
"*The default cookie flavour \(browser\) to search for cookies."
:type '(choice
(defcustom lj-cookie-flavour 'auto
"*The default cookie flavour \(browser\) to search for cookies."
:type '(choice
(set-extent-property
(insert-face "</head>\n" 'default) 'invisible t)
(insert lj-header-separator "\n")
(set-extent-property
(insert-face "</head>\n" 'default) 'invisible t)
(insert lj-header-separator "\n")
+ (when lj-signature
+ (save-excursion (insert "\n\n" lj-signature)))
(lj-mode))
(defun lj-goto-subject (&optional nocreate)
(lj-mode))
(defun lj-goto-subject (&optional nocreate)
nil t)
(replace-match "<h3>Writer's Block Answer</h3>" t))))
nil t)
(replace-match "<h3>Writer's Block Answer</h3>" t))))
+(defconst lj-byline
+ (format (concat "<br />"
+ "<p style=\"text-align:right;font-family:verdana,"
+ "helvetica,sans-serif;font-size:8pt;\">"
+ "Posted via: <a href=\"http://www.sxemacs.org/lj.el\""
+ " title=\"Download SXEmacs/LJ\">"
+ "SXEmacs/LJ</a> (%s)</p>")
+ lj-clientversion)
+ "A client by-line to add to bottom of a post.
+
+It is also included when validating or previewing a post.")
+
(defun lj-validate ()
"Check the markup in a LJ post.
(defun lj-validate ()
"Check the markup in a LJ post.
(save-restriction
(narrow-to-region (point) (point-max))
(buffer-string))))
(save-restriction
(narrow-to-region (point) (point-max))
(buffer-string))))
+ (and lj-self-promote
+ (insert lj-byline))
(insert lj-validate-footer)
(lj-ljtags-to-html)
(write-region (point-min) (point-max) vf))
(insert lj-validate-footer)
(lj-ljtags-to-html)
(write-region (point-min) (point-max) vf))
(save-restriction
(narrow-to-region (point) (point-max))
(buffer-string))))
(save-restriction
(narrow-to-region (point) (point-max))
(buffer-string))))
+ (and lj-self-promote
+ (insert lj-byline))
(insert "\n</div>")
(insert lj-validate-footer)
(lj-ljtags-to-html)
(insert "\n</div>")
(insert lj-validate-footer)
(lj-ljtags-to-html)
(run-hooks 'lj-before-post-hook)
(let ((subject (lj-header-content "subject"))
(body (and (lj-goto-body)
(run-hooks 'lj-before-post-hook)
(let ((subject (lj-header-content "subject"))
(body (and (lj-goto-body)
- (buffer-substring-no-properties (point) (point-max))))
+ (if lj-self-promote
+ (concat
+ (buffer-substring-no-properties (point) (point-max))
+ lj-byline)
+ (buffer-substring-no-properties (point) (point-max)))))
(user lj-user-id)
(security (lj-header-content "security"))
(tags (lj-header-content "tags"))
(user lj-user-id)
(security (lj-header-content "security"))
(tags (lj-header-content "tags"))