Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Push out some changes I had laying around. Switch to htmlfontify.

  • Loading branch information...
commit c83096b2b7539825bd18b746979fc5a1de204a90 1 parent 702e5fd
@technomancy authored
Showing with 17 additions and 16 deletions.
  1. +5 −4 README.md
  2. +12 −12 scpaste.el
View
9 README.md
@@ -10,8 +10,6 @@ its transport and uses Emacs' font-lock as its syntax highlighter
instead of relying on a third-party syntax highlighter for which
individual language support must be added one-by-one.
-It has been tested in Emacs 23, but it should work in 22.
-
## Installation
Install via [Marmalade](http://marmalade-repo.org) or from source via
@@ -32,8 +30,6 @@ key of the host referenced in `scpaste-scp-destination' is in your
known hosts file--scpaste will not prompt you to add it but will
simply hang.
-Depends upon htmlize.
-
## Usage
`M-x scpaste`, (or `scpaste-region`) enter a name, and press
@@ -51,6 +47,11 @@ in `scpaste-http-destination` by invoking `M-x scpaste-index`. This
will upload an explanation as well as a listing of existing
pastes. If a paste's filename includes "private" it will be skipped.
+## Todo
+
+* Automatically linkify URLs inside htmlfontify (stick it on the
+ hfy-opts group of misc tunables according to fledermaus)
+
## Copyright
Copyright © 2008-2011 Phil Hagelberg. Distributed under the same terms
View
24 scpaste.el
@@ -4,11 +4,11 @@
;; Author: Phil Hagelberg
;; URL: http://www.emacswiki.org/cgi-bin/wiki/SCPaste
-;; Version: 0.4
+;; Version: 0.5
;; Created: 2008-04-02
;; Keywords: convenience hypermedia
;; EmacsWiki: SCPaste
-;; Package-Requires: ((htmlize "1.37"))
+;; Package-Requires: ((htmlfontify "0.21"))
;; This file is NOT part of GNU Emacs.
@@ -52,10 +52,6 @@
;; known hosts file--scpaste will not prompt you to add it but will
;; simply hang.
-;;; Todo:
-
-;; Make htmlize convert all URLs to hyperlinks
-
;;; License:
;; This program is free software; you can redistribute it and/or modify
@@ -75,8 +71,8 @@
;;; Code:
-(require 'url) ;; Included in recent version of Emacs; available for pre-22.
-(require 'htmlize) ;; http://fly.srk.fer.hr/~hniksic/emacs/htmlize.el.html
+(require 'url)
+(require 'htmlfontify)
(defvar scpaste-http-destination
"http://p.hagelb.org"
@@ -101,7 +97,9 @@ You must have write-access to this directory via `scp'.")
(defun scpaste (original-name)
"Paste the current buffer via `scp' to `scpaste-http-destination'."
(interactive "MName (defaults to buffer name): ")
- (let* ((b (htmlize-buffer))
+ (let* ((b (save-excursion
+ (htmlfontify-buffer)
+ (current-buffer)))
(name (url-hexify-string (if (equal "" original-name)
(buffer-name)
original-name)))
@@ -113,7 +111,8 @@ You must have write-access to this directory via `scp'.")
;; Save the file (while adding footer)
(save-excursion
(switch-to-buffer b)
- (search-forward " </body>\n</html>")
+ (goto-char (point-min))
+ (search-forward "</body>\n</html>")
(insert (format scpaste-footer
(current-time-string)
(substring full-url 0 -5)))
@@ -126,7 +125,7 @@ You must have write-access to this directory via `scp'.")
;; Notify user and put the URL on the kill ring
(let ((x-select-enable-primary t))
- (kill-new "you suck most"))
+ (kill-new full-url))
(message "Pasted to %s (on kill ring)" full-url)))
;;;###autoload
@@ -154,7 +153,8 @@ You must have write-access to this directory via `scp'.")
(forward-line -1)
(insert "\n;;; Pasted Files\n\n")
(dolist (file file-list)
- (when (not (string-match "\\(^Password\\|private\\)" file))
+ (when (and (string-match "\\.html$" file)
+ (not (string-match "private" file)))
(insert (concat ";; * <" scpaste-http-destination "/" file ">\n"))))
(emacs-lisp-mode) (font-lock-fontify-buffer) (rename-buffer "SCPaste")
(write-file "/tmp/scpaste-index")
Please sign in to comment.
Something went wrong with that request. Please try again.