diff options
32 files changed, 0 insertions, 2613 deletions
diff --git a/attic/furl.applescript b/attic/furl.applescript deleted file mode 100644 index 6823ff0..0000000 --- a/attic/furl.applescript +++ /dev/null @@ -1 +0,0 @@ -tell application "Firefox" to get Çclass curlÈ of window 1 diff --git a/attic/jao-applescript.el b/attic/jao-applescript.el deleted file mode 100644 index 233186c..0000000 --- a/attic/jao-applescript.el +++ /dev/null @@ -1,65 +0,0 @@ -;;; AppleScript and some macish bits -(autoload 'applescript-mode "applescript-mode" - "major mode for editing AppleScript source." t) -(setq auto-mode-alist - (cons '("\\.applescript$" . applescript-mode) auto-mode-alist)) - -(defun do-applescript (script) - (with-temp-buffer - (insert script) - (shell-command-on-region (point-min) (point-max) "osascript" t) - (buffer-string))) - -(defun jao-as-tell-app (app something) - (let ((res (do-applescript (format "tell application \"%s\"\n%s\nend tell" - app something)))) - (or (and (stringp res) (substring res 0 -1)) ""))) - -(defmacro jao-as-get-doc (name application &optional doc) - `(defun ,name () - (interactive) - (let ((url (jao-as-tell-app ,application - ,(format "get the URL of %s 1" - (or doc "document")))) - (name (jao-as-tell-app ,application "get the name of document 1"))) - (cons url name)))) -(jao-as-get-doc jao-as-safari-doc "Safari") -(jao-as-get-doc jao-as-webkit-doc "WebKit") -(jao-as-get-doc jao-as-camino-doc "Camino" "window") - -(defun jao-as-firefox-doc () - (interactive) - (let ((url (shell-command-to-string - (concat "osascript " - (expand-file-name "furl.applescript" - (file-name-directory load-file-name))))) - (name (jao-as-tell-app "Firefox" "get the name of window 1"))) - (cons (substring url 0 -1) name))) - - -;;; quicksilver -(defun jao-qs-buffer () - "Opens the current file in Quicksilver" - (interactive) - (cond ((and buffer-file-name (file-exists-p buffer-file-name)) - (call-process-shell-command (concat "qs \"" buffer-file-name "\""))) - ;; dired handling - ((eq major-mode 'dired-mode) - (dired-do-shell-command "qs * " - current-prefix-arg - (dired-get-marked-files t current-prefix-arg))) - ;; buffer-menu mode - ((and (eq major-mode 'Buffer-menu-mode) - (file-exists-p (buffer-file-name (Buffer-menu-buffer nil)))) - (call-process-shell-command - (concat "qs \"" (buffer-file-name (Buffer-menu-buffer nil)) "\""))) - (t - (error "Not visiting a file or file doesn't exist")))) - - (defun jao-qs-region (start end) - "Opens the contents of the region in Quicksilver as text." - (interactive "r") - (call-process-region start end "qs" nil 0 nil "-")) - - -(provide 'jao-applescript) diff --git a/attic/jao-devon.el b/attic/jao-devon.el deleted file mode 100644 index 65e989f..0000000 --- a/attic/jao-devon.el +++ /dev/null @@ -1,75 +0,0 @@ -;; DEVONthink interaction - -(require 'jao-applescript) - -(defconst *jao-devon-sep* "####") - -(defun jao-devon-path (dvp) - (car (split-string dvp *jao-devon-sep*))) -(defun jao-devon-url (dvp) - (cadr (split-string dvp *jao-devon-sep*))) -(defun jao-devon-name (dvp) - (car (last (split-string (jao-devon-path dvp) "/")))) - -(defun jao-devon-make-dvp (path url) (concat path *jao-devon-sep* name)) -(defun jao-devon-dvp-p (dvp) - (and (stringp dvp) - (string-match (concat "^/.+" *jao-devon-sep*) dvp))) - -(defconst *jao-devon-sel-as* - (concat "set rs to the selection - set r to item 1 of rs - set rn to the name of r - set rl to the reference URL of r - set ru to the URL of r - \"[[\" & rl & \"" *jao-devon-sep* - "\" & ru & \"][\" & rn & \"]]\"")) - -(defun jao-devon-selection () - (jao-as-tell-app "DEVONThink Pro" *jao-devon-sel-as*)) - -;; (defun jao-devon-open-as (path) -;; (concat "set r to get record at \"" path "\"" -;; "\n open window for record r\n activate")) - -(defun jao-devon-open (dvp) - (if (eq system-type 'darwin) - (let* ((path (jao-devon-path dvp)) - (cmd (and path (format "open x-devonthink-item:%s" path)))) - (when cmd (shell-command-to-string cmd))) - (browse-url (jao-devon-url dvp)))) - -(defun jao-devon-add-html-page (title url html) - (let ((as (format "tell application id \"com.devon-technologies.thinkpro2\" to create record with {name:%S, type:html, URL:%S, source:%S}" - title url html))) - (do-applescript as))) - -(defun jao-devon-add-w3m-page () - "Add current w3m page to devonthink." - (interactive) - (let ((title (w3m-current-title)) - (url w3m-current-url)) - (when url - (w3m-view-source) - (let ((html (buffer-substring-no-properties (point-min) (point-max)))) - (jao-devon-add-html-page title url html)) - (w3m-view-source)))) - -(with-eval-after-load "org" - (autoload 'jao-as-safari-doc "jao-applescript.el") - - (defun jao-org-insert-devon-link () - (interactive) - (insert (jao-devon-selection))) - - (defun jao-org-insert-safari-link () - (interactive) - (let ((ln (jao-as-safari-doc))) - (when ln (jao-org-insert-link (car ln) (cdr ln))))) - - (org-add-link-type "x-devonthink-item" 'jao-devon-open 'identity) - - (define-key org-mode-map "\C-cd" 'jao-org-insert-devon-link) - (define-key org-mode-map "\C-cs" 'jao-org-insert-safari-link)) - -(provide 'jao-devon) diff --git a/attic/jao-org-tags.el b/attic/jao-org-tags.el deleted file mode 100644 index b00276d..0000000 --- a/attic/jao-org-tags.el +++ /dev/null @@ -1,61 +0,0 @@ -;; lifted from http://orgmode.org/worg/org-hacks.php - -(require 'org) - -(defvar ba/org-adjust-tags-column nil) - -(defun ba/org-adjust-tags-column-reset-tags () - "In org-mode buffers it will reset tag position according to -`org-tags-column'." - (when (and - (not (string= (buffer-name) "*Remember*")) - (eql major-mode 'org-mode)) - (let ((b-m-p (buffer-modified-p))) - (condition-case nil - (save-excursion - (goto-char (point-min)) - (command-execute 'outline-next-visible-heading) - ;; disable (message) that org-set-tags generates - (flet ((message (&rest ignored) nil)) - (org-set-tags 1 t)) - (set-buffer-modified-p b-m-p)) - (error nil))))) - -(defun ba/org-adjust-tags-column-now () - "Right-adjust `org-tags-column' value, then reset tag position." - (set (make-local-variable 'org-tags-column) - (- (- (window-width) 3))) - (ba/org-adjust-tags-column-reset-tags)) - -(defun ba/org-adjust-tags-column-maybe () - "If `ba/org-adjust-tags-column' is set to non-nil, adjust tags." - (when ba/org-adjust-tags-column - (ba/org-adjust-tags-column-now))) - -(defun ba/org-adjust-tags-column-before-save () - "Tags need to be left-adjusted when saving." - (when ba/org-adjust-tags-column - (setq org-tags-column 1) - (ba/org-adjust-tags-column-reset-tags))) - -(defun ba/org-adjust-tags-column-after-save () - "Revert left-adjusted tag position done by before-save hook." - (ba/org-adjust-tags-column-maybe) - (set-buffer-modified-p nil)) - -;; automatically align tags on right-hand side -(defun jao-org-tags-setup () - (setq ba/org-adjust-tags-column t) - (add-hook 'window-configuration-change-hook - 'ba/org-adjust-tags-column-maybe) - (add-hook 'before-save-hook 'ba/org-adjust-tags-column-before-save) - (add-hook 'after-save-hook 'ba/org-adjust-tags-column-after-save)) - -(defun jao-org-tags-uninstall () - (setq ba/org-adjust-tags-column nil) - (remove-hook 'window-configuration-change-hook - 'ba/org-adjust-tags-column-maybe) - (remove-hook 'before-save-hook 'ba/org-adjust-tags-column-before-save) - (remove-hook 'after-save-hook 'ba/org-adjust-tags-column-after-save)) - -(provide 'jao-org-tags) diff --git a/attic/jao-osx-mail.el b/attic/jao-osx-mail.el deleted file mode 100644 index 8b9efda..0000000 --- a/attic/jao-osx-mail.el +++ /dev/null @@ -1,13 +0,0 @@ -(defun jao--gnus-message-id () - (require 'org-gnus) - (let ((header (with-current-buffer gnus-summary-buffer - (gnus-summary-article-header)))) - (and header (org-remove-angle-brackets (mail-header-id header))))) - -(defun jao-gnus-open-in-mail () - (interactive) - (let ((id (jao--gnus-message-id))) - (unless id (error "no message selected")) - (shell-command-to-string (format "open 'message:<%s>'" id)))) - -(provide 'jao-osx-mail) diff --git a/attic/jao-w3m-session.el b/attic/jao-w3m-session.el deleted file mode 100644 index 63c7766..0000000 --- a/attic/jao-w3m-session.el +++ /dev/null @@ -1,410 +0,0 @@ -;;; w3m-session.el --- Persistent emacs-w3m sessions - -;; Copyright (C) 2003, 2004, 2006, 2007, 2008, 2009, 2012 Jose A Ortega Ruiz - -;; Author: Jose A Ortega Ruiz <jao@member.fsf.org> -;; Version: 0.3.6 -;; Keywords: hypermedia, w3m, WWW - -;; This file is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation; either version 3, or (at your option) -;; any later version. - -;; This file is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with GNU Emacs; see the file COPYING. If not, write to -;; the Free Software Foundation, Inc., 59 Temple Place - Suite 330, -;; Boston, MA 02111-1307, USA. - -;;; Commentary: - -;; INTRODUCTION: -;; -;; jao-w3m-session provides persistent emacs-w3m browsing sessions. When -;; quitting w3m (or, if you request it, at any other time while using -;; it) you can save the current w3m session (that is, the set of open -;; tabs and the URLs they're visiting). Upon restarting emacs-w3m -;; (possibly after restarting Emacs itself) you'll have the possibity -;; of recovering the saved session (that is, of re-opening the saved -;; tabs and URLs). You also have at your disposal a command to recover -;; the saved session at any other time. -;; -;; INSTALLATION: -;; -;; Just put this file somewhere on your Emacs load path and add the -;; following line to your .emacs file: -;; -;; (require 'jao-w3m-session) -;; -;; After restarting Emacs (or evaluating the form above), each time -;; you start emacs-w3m with 'w3m' you'll get a prompt asking whether -;; your last browsing session should be loaded. Likewise, when -;; quitting the browser, you'll have the possibility of saving your -;; current session (overwriting the previous one). -;; -;; In addition, two new interactive functions are defined: -;; -;; jao-w3m-session-load -- load the last stored session -;; jao-w3m-session-save -- save the current session -;; -;; These functions can be invoked at any time while running emacs-w3m. -;; Optionally, you can bind them to key shortcuts with the proper -;; variations of the following elisp magic in your .emacs: -;; (defun w3m-add-keys () -;; (define-key w3m-mode-map "S" 'jao-w3m-session-save) -;; (define-key w3m-mode-map "L" 'jao-w3m-session-load)) -;; (add-hook 'w3m-mode-hook 'w3m-add-keys) -;; -;; CUSTOMIZATION: -;; -;; A new customization group, jao-w3m-session, is available. There you can -;; customize the following variables: -;; -;; jao-w3m-session-load-always -- if t, `jao-w3m-session-load' will *not* ask -;; for confirmation (default nil) -;; jao-w3m-session-save-always -- if t, `jao-w3m-session-save' will *not* ask -;; for confirmation (default nil) -;; jao-w3m-session-show-titles -- if t, the load prompt will list the -;; session URL titles (default t) -;; jao-w3m-session-duplicate-tabs -- what to do when loading a session that -;; contains a URL already open -;; jao-w3m-session-file -- the file where w3m session info -;; is stored (default "~/.jao-w3m-session") -;; jao-w3m-session-autosave-period -- the period, in seconds, for automatic -;; session backup file updating. -;; -;; -;; You can also customize them in your .emacs file, to wit: -;; -;; (setq jao-w3m-session-file "~/.emacs.d/jao-w3m-session") -;; (setq jao-w3m-session-save-always nil) -;; (setq jao-w3m-session-load-always nil) -;; (setq jao-w3m-session-show-titles t) -;; (setq jao-w3m-session-duplicate-tabs 'ask) ; 'never, 'always, 'ask -;; -;; HISTORY: -;; -;; Version 0.3.7 : -;; -;; - `jao-w3m-session-deactivate-builtin-sessions', to do what it -;; says. -;; -;; Version 0.3.6 (Sat Apr 19, 2008): -;; -;; - w3m-session -> jao-w3m-session to avoid collisions with -;; emacs-w3m's session manager. -;; -;; Version 0.3.5 (Sun Jan 14, 2007): -;; -;; - automatic session backup every `jao-w3m-session-autosave-period' -;; seconds. -;; -;; Version 0.3.4 (Wed Jul 19, 2006): -;; -;; - save session file on quitting Emacs (without using -;; desktop.el) -;; -;; Version 0.3.3 (Thu Jun 8, 2006): -;; -;; - save session file with pretty print. -;; - handle correctly multiple emacs-w3m (re)starts during a -;; single emacs session. -;; - save URLs in hexified form to allow & in them. -;; - code cleanup. -;; -;; Version 0.3.2 (Mon Sep 29, 2003): -;; -;; - bug fix: when searching or going to home/bookmarks/etc, -;; keep the current tab's focus. -;; -;; Version 0.3.1 (Tue Aug 26, 2003): -;; -;; - type of `jao-w3m-session-file' set to 'file' in customisation -;; buffer. -;; - bug fix: syntax error due to a typo in `jao-w3m-session-file' -;; -;; Version 0.3 (Mon Aug 25, 2003): -;; -;; - the load session tab lists the titles of the session's pages -;; (customizable via 'jao-w3m-session-show-titles'). -;; - the duplicated tab prompt displays also the URL's title. -;; - bug fix: active tab in session now is correctly saved. -;; -;; Version 0.2 (Fri Aug 22, 2003): -;; -;; - the session info now includes the active tab, which gets -;; displayed when the session is reloaded. -;; - when reloading a session in a running emacs-w3m, if the -;; session contains a URL that is already being displayed by the -;; browser, the tab can be reused or duplicated (customizable -;; via `jao-w3m-session-duplicate-tabs'). -;; -;; Version 0.1 (Wed Aug 20, 2003) -- Initial release. -;; - - -;;; Code: - -;;; Dependencies: - -(require 'w3m) -(require 'advice) -(require 'url-util) - -;;; Custom variables: - -(defgroup jao-w3m-session nil - "w3m - session saving in w3m." - :group 'w3m - :prefix "jao-w3m-session-") - -(defcustom jao-w3m-session-save-always nil - "If on, always save w3m session without asking." - :group 'jao-w3m-session - :type 'boolean) - -(defcustom jao-w3m-session-load-always nil - "If on, always load w3m session without asking." - :group 'jao-w3m-session - :type 'boolean) - -(defcustom jao-w3m-session-show-titles t - "If on, show URL titles in the load prompt." - :group 'jao-w3m-session - :type 'boolean) - -(defcustom jao-w3m-session-duplicate-tabs 'never - "How to treat session URL already being visited. - -When loading a session with `jao-w3m-session-load', if one of the URLs in -the session is already displayed in a w3m tab, jao-w3m-session can: -- `never' create a new tab (just reload it), or -- `always' duplicate the URL in a new tab, or -- `ask' the user what to do." - :group 'jao-w3m-session - :type '(choice (const :value never) - (const :value always) - (const :value ask))) - -(defcustom jao-w3m-session-file "~/.jao-w3m-session" - "File to save the w3m session data." - :group 'jao-w3m-session - :type 'file) - -(defvar jao-w3m-session-autosave-period 180 - "A backup of the current session is saved with this period (in secs).") - -(defvar jao-w3m-url-filters nil "URL filters.") - -;;; Interactive functions: - -(defun jao-w3m-session-save () - "Save the current w3m session." - (interactive) - (when (and (w3m-alive-p) - (or jao-w3m-session-save-always - (y-or-n-p "Save current w3m session? "))) - (jao-w3m-session-current-to-file) - (jao-w3m-session--restart--autosave))) - -(defun jao-w3m-session-load () - "Load last stored session into w3m." - (interactive) - (let ((s (jao-w3m-session-load-aux))) - (when s - (jao-w3m-session--restart--autosave) - (let* ((urls (jao-w3m-session-url s)) - (offset (jao-w3m-session-offset s)) - (buffers (unless (equal jao-w3m-session-duplicate-tabs 'always) - (jao-w3m-session-find-duplicated urls)))) - (w3m-goto-url-new-session urls t) - (when buffers (jao-w3m-session-close-buffers buffers)) - (unless (zerop offset) (w3m-next-buffer offset)))))) - -(defun jao-w3m-session-set-autosave-period (secs) - "Set new value for the period between session backup autosaves." - (interactive "p") - (let ((secs (or secs (read-number "New period (secs): " 0)))) - (when (> secs 0) - (setq jao-w3m-session-autosave-period secs) - (jao-w3m-session--restart--autosave)))) - -(defun jao-w3m-session-deactivate-builtin-sessions () - "Deactivate emacs-w3m's builtin session handling." - (setq w3m-session-deleted-save nil - w3m-session-autosave nil - w3m-session-deleted-keep-number 0 - w3m-session-crash-recovery nil)) - -;;; Internals: - -;;;; advice w3m to use session management - -(defadvice w3m (before jao-load-session activate) - "Optionally load last w3m session on startup." - (interactive - (let ((s (jao-w3m-session-load-aux))) - (list (or (and s (jao-w3m-session-url s)) w3m-home-page) t t)))) - -(defadvice w3m (after jao-select-tab activate) - "Goto the saved focused tab" - (interactive) - (let ((offset (jao-w3m-session-offset))) - (unless (zerop offset) - (w3m-next-buffer offset)) - (ad-deactivate 'w3m))) - -(defadvice w3m-quit (before jao-save-session activate) - "Save session before quitting." - (interactive) - (jao-w3m-session-save) - ;; this is a little hack: when quitting a w3m session with a tab - ;; selected other than the first, the frame is not automatically - ;; closed as should be when w3m-pop-up-frames is t: - (switch-to-buffer (car (w3m-list-buffers))) - (ad-activate 'w3m)) - -;;;; save session on exit -(add-to-list 'kill-emacs-query-functions - (lambda () (jao-w3m-session-save) t)) - - -;;;; auxiliary functions - -(defvar jao-w3m-current-session '(jao-w3m-session 0 nil)) - -(defun jao-w3m-session--filter (url filters) - (cond ((not filters) url) - ((string-match-p (caar filters) url) - (cond ((functionp (cdar filters)) (funcall (cadr filters) url)) - ((stringp (cdar filters)) (cdar filters)))) - (t (jao-w3m-session--filter url (cdr filters))))) - -(defun jao-w3m-session--current-urls () - (let ((urls) - (current-buffer (w3m-alive-p)) - (pos 0) - (count 0)) - (dolist (b (w3m-list-buffers) (list pos (reverse urls))) - (set-buffer b) - (let ((url (jao-w3m-session--filter w3m-current-url jao-w3m-url-filters))) - (when url - (when (eq b current-buffer) (setq pos count)) - (setq count (1+ count)) - (push (cons (url-hexify-string url) (w3m-buffer-title b)) urls)))))) - -(defun jao-w3m-session-url (&optional s) - (let ((s (or s jao-w3m-current-session))) - (concat "group:" - (mapconcat 'car (nth 2 s) "&")))) - -(defun jao-w3m-session-offset (&optional s) - (let ((s (or s jao-w3m-current-session))) - (nth 1 s))) - -(defun jao-w3m-session-titles (&optional s) - (let ((s (or s jao-w3m-current-session))) - (mapcar 'cdr (nth 2 s)))) - -(defun jao-w3m-session-current (&optional s) - (save-current-buffer - (setq jao-w3m-current-session - (or s (cons 'jao-w3m-session (jao-w3m-session--current-urls)))))) - -(defun jao-w3m-session-current-url () - (when (w3m-alive-p) - (save-current-buffer - (concat "group:" - (mapconcat (lambda (b) (set-buffer b) w3m-current-url) - (w3m-list-buffers) "&"))))) - -(defun jao-w3m-session-find-duplicated (urls) - (when (w3m-alive-p) - (save-current-buffer - (let* ((duplicate-p - (lambda (b) - (y-or-n-p - (format "'%s' (%s) is already open. Duplicate tab? " - (w3m-buffer-title b) w3m-current-url)))) - (test-b - (lambda (b) - (set-buffer b) - (if (and - (string-match (regexp-quote w3m-current-url) urls) - (or (equal jao-w3m-session-duplicate-tabs 'never) - (not (funcall duplicate-p b)))) - b 'not))) - (buffers (mapcar test-b (w3m-list-buffers)))) - (delete 'not buffers))))) - -(defun jao-w3m-session-close-buffers (buffers) - (save-current-buffer - (mapc 'kill-buffer buffers))) - -(defun jao-w3m-session-load-aux () - (let ((new-session (jao-w3m-session-from-file - (expand-file-name jao-w3m-session-file)))) - (if (and new-session - (or jao-w3m-session-load-always - (y-or-n-p - (if jao-w3m-session-show-titles - (format "Load last w3m session %S? " - (jao-w3m-session-titles new-session)) - "Load last w3m session? ")))) - (jao-w3m-session-current new-session) - nil))) - -(defun jao-w3m-session-from-file (fname) - (let ((fname (jao-w3m-session--check--backup fname))) - (if (file-readable-p fname) - (with-temp-buffer - (insert-file-contents fname) - (goto-char (point-min)) - (let ((sexp (read (current-buffer)))) - (and (equal 'jao-w3m-session (car sexp)) sexp))) - nil))) - -(defsubst jao-w3m-session-current-to-file () - (jao-w3m-session--to--file jao-w3m-session-file)) - -(defun jao-w3m-session--to--file (filename &optional is-auto) - (require 'pp) - (let ((msg (if is-auto (current-message)))) - (with-temp-buffer - (insert ";;;; File generated by jao-w3m-session. DO NOT EDIT!\n") - (pp (jao-w3m-session-current) (current-buffer)) - (insert "\n" ";;;; End of " - (file-name-nondirectory jao-w3m-session-file) "\n") - (write-region (point-min) (point-max) (expand-file-name filename))) - (if is-auto (message msg)))) - -(defvar jao-w3m-session--timer nil) - -(defun jao-w3m-session--backup-name (fname) - (concat (expand-file-name fname) ".bak")) - -(defun jao-w3m-session--check--backup (fname) - (let ((bfname (jao-w3m-session--backup-name fname))) - (if (and (file-newer-than-file-p bfname fname) - (y-or-n-p "A newer autosaved session exists. Use it? ")) - bfname - fname))) - -(defun jao-w3m-session--restart--autosave () - (when (> jao-w3m-session-autosave-period 0) - (if jao-w3m-session--timer (cancel-timer jao-w3m-session--timer)) - (setq jao-w3m-session--timer - (run-at-time jao-w3m-session-autosave-period - jao-w3m-session-autosave-period - 'jao-w3m-session--to--file - (jao-w3m-session--backup-name jao-w3m-session-file) - t)))) - -(provide 'jao-w3m-session) - -;;; jao-w3m-session.el ends here diff --git a/attic/jao-weather.el b/attic/jao-weather.el deleted file mode 100644 index 04a8523..0000000 --- a/attic/jao-weather.el +++ /dev/null @@ -1,219 +0,0 @@ -;; Based on code by Thierry Volpiatto -;; (http://mercurial.intuxication.org/hg/xml-weather) - -(require 'xml) -(require 'derived) - - -;;; config: -(defvar jao-weather-format-id-url - "http://xoap.weather.com/search/search?where=%s") - -(defvar jao-weather-format-xml-from-id-url ; id, unit=m,day-forecast=5,login,key - "http://xoap.weather.com/weather/local/%s?cc=*&unit=%s&dayf=%s&prod=xoap&par=%s&key=%s") - -(defvar jao-weather-unit "m" - "*m mean metric, you will have wind speed in km/h, temperature in °C and so on.") - -(defvar jao-weather-login nil) -(defvar jao-weather-key nil) - -(defvar jao-weather-day-forecast-num 5 - "*Number of days for forecast; Maximum 5.") - -(defvar jao-weather-default-id "SPXX0015") - -(defvar jao-weather-timer-delay 3600) - -(defvar jao-weather-last-data nil) - - -;;; access: -(defun jao-weather-authentify () - "Authentify user from .authinfo file. -You have to setup correctly `auth-sources' to make this function -finding the path of your .authinfo file that is normally ~/.authinfo. -Entry in .authinfo should be: -machine xoap.weather.com port http login xxxxx password xxxxxx" - (let ((auth (auth-source-user-or-password '("login" "password") - "xoap.weather.com" - "http"))) - (setq jao-weather-login (car auth) - jao-weather-key (cadr auth)))) - -(defun jao-weather--url (id) - (unless (and jao-weather-login jao-weather-key) - (jao-weather-authentify)) - (format jao-weather-format-xml-from-id-url - (or id jao-weather-default-id) - jao-weather-unit - (min jao-weather-day-forecast-num 5) - jao-weather-login - jao-weather-key)) - -(defvar jao-weather-hook nil) - -;; http://xoap.weather.com/weather/local/[locid] -;; Replace the [locid], of course, with the location ID obtained in the previous step. -;; Appended to this URL is a mix of other parameters, -;; some required and some optional. A typical example might be: -;; http://xoap.weather.com/weather/local/NLXX0002?cc=*&dayf=5&prod=xoap&par=[partner id]&key=[license key] -(defun jao-weather--get-info-async (&optional id) - (let ((url (jao-weather--url id)) - (url-show-status nil)) - (url-retrieve url (lambda (res) - (when (not res) - (let ((data (jao-weather-get-alist))) - (when data - (setq jao-weather-last-data data) - (run-hooks 'jao-weather-hook)))) - (kill-buffer (current-buffer)))))) - -(defun jao-weather--get-info-now (&optional id) - (let* ((url (jao-weather--url id)) - (buffer (url-retrieve-synchronously url)) - (data (and buffer - (with-current-buffer buffer - (jao-weather-get-alist))))) - (when buffer (kill-buffer buffer)) - (when data - (setq jao-weather-last-data data) - (run-hooks 'jao-weather-hook)) - data)) - - -;;; formatting: -(defun jao-weather--flist (c fs) - (when c - (let (result) - (dolist (f fs result) - (let ((v (caddr (assoc (cadr f) c)))) - (when (and (stringp v) (not (string-equal v "N/A"))) - (push (cons (car f) v) result))))))) - -(defun jao-weather--parse-cc (cc) - (append (jao-weather--flist cc '((:date lsup) - (:observatory obst) - (:temperature tmp) - (:condition t) - (:pressure r))) - (jao-weather--flist (assoc 'wind cc) '((:windir d) - (:wind-tilt t) - (:gust gust))))) - -(defun jao-weather--parse-location (loc) - (jao-weather--flist loc '((:city dnam) - (:time tm) - (:latitude lat) - (:longitude lon) - (:sunrise sunr) - (:sunset suns)))) - -(defun jao-weather--parse-day (d) - (let ((p2 (assoc 'part - (remove (assoc 'part (cdr d)) - (cdr d)))) - (wday (or (cdr (assoc 't (cadr d))) "day"))) - `(,(cdr (assoc 'dt (cadr d))) - (:weekday . ,wday) - (:weekday-abbrev . ,(substring wday 0 3)) - ,@(jao-weather--flist (cdr d) '((:max hi) - (:min low) - (:sunrise sunr) - (:sunset suns) - (:humidity hmid))) - ,@(jao-weather--flist (assoc 'wind (assoc 'part (cdr d))) - '((:wind-dir 't) (:wind-speed 's))) - ,@(jao-weather--flist (assoc 'wind p2) '((:night-wind-dir wea) - (:night-wind-speed s))) - ,@(jao-weather--flist p2 - '((:night-condition t) (:night-humidity hmid)))))) - -(defun jao-weather-get-alist () - (let* ((pxml (car (xml-parse-region (point-min) (point-max)))) - (loc (car (xml-get-children pxml 'loc))) - (cc (car (xml-get-children pxml 'cc))) - (dayf (xml-get-children pxml 'dayf)) - (dayfs (xml-get-children (car dayf) 'day)) - (today (append (jao-weather--parse-cc cc) - (jao-weather--parse-location loc))) - (forecast (mapcar 'jao-weather--parse-day dayfs))) - `((today ,@today) (forecast ,@forecast)))) - -(defun jao-weather--format-fields (data fields sep) - (if data - (mapconcat (lambda (kv) - (let ((v (cdr (assoc (car kv) data)))) - (if (not v) "" - (format (or (cdr kv) "%s") v)))) - fields - sep) - "")) - -(defsubst jao-weather--today-string (fields sep) - (jao-weather--format-fields (cdr (assoc 'today jao-weather-last-data)) - fields sep)) - -(defun jao-weather--forecast-string (n fields sep) - (jao-weather--format-fields (nth n (cdr (assoc 'forecast - jao-weather-last-data))) - fields sep)) - - -;;; update daemon: -(defvar jao-weather--timer nil) -(defun jao-weather-start (&optional delay) - (interactive) - (jao-weather-stop) - (setq jao-weather--timer - (run-with-timer (or delay 0) - jao-weather-timer-delay - 'jao-weather--get-info-async))) - -(defun jao-weather-stop () - (interactive) - (when jao-weather--timer - (cancel-timer jao-weather--timer) - (setq jao-weather--timer nil))) - - -;;; today -(defun jao-weather-today-msg (&optional arg) - (interactive "p") - (when (> arg 4) (jao-weather--get-info-now)) - (if (= 4 arg) (jao-weather-forecast-msg) - (message "%s" (jao-weather--today-string '((:temperature . " %s°C") - (:condition . "(%s)") - (:sunrise . "↑ %s") - (:sunset . "↓ %s") - (:date . "[%s]")) - " ")))) - -(defun jao-weather-forecast-msg (&optional arg) - (interactive "P") - (when arg (jao-weather--get-info-now)) - (message " %s" (mapconcat - (lambda (n) - (jao-weather--forecast-string n - '((:weekday-abbrev . "%s ") - (:max . "%s°/") - (:min . "%s°") - (:condition . ", %s") - (:night-condition . ", %s")) - "")) - '(1 2 3 4) " | "))) - -(defun jao-weather-temperature () - (string-to-number (jao-weather--today-string '((:temperature)) ""))) - - -(defun jao-weather-temperature* (&optional sep) - (concat (jao-weather--today-string '((:temperature . "%s°")) "") - (or sep " ") - (jao-weather--forecast-string 1 - '((:max . "%s°/") (:min . "%s°") - (:night-condition . " %s")) - ""))) - -;; Provide -(provide 'jao-weather) diff --git a/attic/skels/all-skels.el b/attic/skels/all-skels.el deleted file mode 100644 index 720b08e..0000000 --- a/attic/skels/all-skels.el +++ /dev/null @@ -1,49 +0,0 @@ -;;; all-skels.el --- Convenience package loading all skels - -;; Copyright (C) 2008 Jose Ortega - -;; Author: Jose Ortega <jao@google.com> -;; Keywords: languages - -;; This program is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation, either version 3 of the License, or -;; (at your option) any later version. - -;; This program is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with this program. If not, see <http://www.gnu.org/licenses/>. - -;;; Commentary: - -;; Require this file to load all defined skels - -;;; Code: - -(require 'init-skel) - -(require 'cpp-skel) -(require 'cppunit-skel) -(require 'perl-skel) -(require 'readme-skel) -(require 'make-skel) -(require 'caml-skel) -(require 'latex-skel) -(require 'noweb-skel) -(require 'lisp-skel) -(require 's48-skel) -(require 'haskell-skel) -(require 'scsh-skel) -(require 'lisa-skel) -(require 'texinfo-skel) -(require 'python-skel) -(require 'muse-skel) -(require 'asdf-skel) - -(provide 'all-skels) - -;;; all-skels.el ends here diff --git a/attic/skels/asdf-skel.el b/attic/skels/asdf-skel.el deleted file mode 100644 index 939eb8d..0000000 --- a/attic/skels/asdf-skel.el +++ /dev/null @@ -1,52 +0,0 @@ -;;; asdf-skel.el --- Skels for ASDF system definition files - -;; Copyright (C) 2007 Jose Antonio Ortega Ruiz - -;; Author: Jose Antonio Ortega Ruiz <jao@gnu.org> -;; Keywords: lisp - -;; This file is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation; either version 2, or (at your option) -;; any later version. - -;; This file is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with GNU Emacs; see the file COPYING. If not, write to -;; the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, -;; Boston, MA 02110-1301, USA. - -;;; Code: - -(require 'common-skel) - -(define-skeleton jao-skel-asdf-file - "ASDF file header" - "Description: " - '(setq sys (jao-basename)) - '(lisp-mode) - ";; -*- lisp -*- " sys " definition" - \n \n - "(defpackage " sys "-system" \n " (:use :common-lisp :asdf))" - \n \n - "(in-package " sys "-system)" - \n \n - "(defsystem " sys - > \n ":description \"" str "\"" - > \n ":version \"0.1\"" - > \n ":author \"" (user-full-name) " <" user-mail-address ">\"" - > \n ":maintainer \"" (user-full-name) " <" user-mail-address ">\"" - > \n ":licence \"GPL\"" - > \n ":depends-on ()" - > \n ":components ((:file \"packages\")))" - \n \n) - -(add-to-list 'auto-insert-alist '("\\.asd\\'" . jao-skel-asdf-file)) - - -(provide 'asdf-skel) -;;; asdf-skel.el ends here diff --git a/attic/skels/caml-skel.el b/attic/skels/caml-skel.el deleted file mode 100644 index 65a5db2..0000000 --- a/attic/skels/caml-skel.el +++ /dev/null @@ -1,42 +0,0 @@ -;; Copyright (C) 2004, 2005, 2009 Jose Antonio Ortega Ruiz - -;; Author: Jose A Ortega Ruiz <jao@gnu.org> -;; Keywords: tools - -;; This file is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation; either version 3, or (at your option) -;; any later version. - -;; This file is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with GNU Emacs; see the file COPYING. If not, write to -;; the Free Software Foundation, Inc., 59 Temple Place - Suite 330, -;; Boston, MA 02111-1307, USA. - -;;; Commentary: - -;; Caml skeletons - -;;; Code: - -(require 'common-skel) - -(define-skeleton jao-skel-caml-file - "OCaml file header" - "Brief description: " - "(* " (file-name-nondirectory (buffer-file-name)) ": " str " *)" - > \n \n - (jao-copyright-line "(* " " *)") - > ?\n - (jao-insert-copyright-file) - "(* $" "Id$ *)" \n \n _) - -(jao-provide-skel "\\.ml[i]?" 'jao-skel-caml-file) - -(provide 'caml-skel) - diff --git a/attic/skels/common-skel.el b/attic/skels/common-skel.el deleted file mode 100644 index 977e7ea..0000000 --- a/attic/skels/common-skel.el +++ /dev/null @@ -1,152 +0,0 @@ -;; common definitions and functions - -;; Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012 Jose Antonio Ortega Ruiz - -;; Author: Jose A Ortega Ruiz <jao@gnu.org> -;; Keywords: tools - -;; This file is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation; either version 3, or (at your option) -;; any later version. - -;; This file is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with GNU Emacs; see the file COPYING. If not, write to -;; the Free Software Foundation, Inc., 59 Temple Place - Suite 330, -;; Boston, MA 02111-1307, USA. - -;;; Commentary: - -;; Aux functions used in other skeletons - -;;; Code: - -(require 'skeleton) -(require 'autoinsert) - -(defvar jao-company-name nil - "Company name used in copyright notice") - -(defvar jao-copyright-file ".copyright" - "Basename of the raw (uncommented) copyright file") - -(defvar jao-skels-default-scm nil - "Default SCM system") - -(defun jao-prefix (pref) (or pref (concat comment-start " "))) -(defun jao-suffix (suff) (or suff (concat " " comment-end))) - -(defun jao-copyright-line (prefix &optional suffix omit-cpy) - "Create a brief copyright notice with given PREFIX and SUFFIX" - (concat (jao-prefix prefix) - (if omit-cpy "" "Copyright ") - "(c) " (format-time-string "%Y") " " - (or jao-company-name (user-full-name)) - (jao-suffix suffix) "\n")) - -(defun jao-date-line (prefix &optional suffix) - "Create a start date line" - (concat (jao-prefix prefix) - "Start date: " (format-time-string "%a %b %d, %Y %H:%M") - (jao-suffix suffix) "\n")) - -(defun jao-author-line (prefix &optional suffix) - "Create an author date line" - (concat (jao-prefix prefix) - "Author: " (user-full-name) " <" user-mail-address "> " - (jao-suffix suffix) "\n")) - -(defun jao-cvs-line (prefix &optional suffix) - "Create a CVS ID line" - (concat (jao-prefix prefix) "$" "Id$" (jao-suffix suffix) "\n")) - -(defun jao-svn-line (prefix &optional suffix) - "Create a SVN ID line" - (concat (jao-prefix prefix) "X-SVN: $" "Id$" (jao-suffix suffix) "\n")) - -(defun jao-arch-line (&optional prefix suffix) - "Create an arch-tag line" - (let ((uuid (shell-command-to-string "uuidgen"))) - (concat (jao-prefix prefix) "arch-tag: " uuid (jao-suffix suffix) "\n"))) - -(defun jao-insert-arch-line () - (interactive) - (insert (jao-arch-line))) - -(defun jao-scm-line (prefix &optional suffix) - "Create an scm line" - (let* ((formats '(("arch" . jao-arch-line) - ("svn" . jao-svn-line) - ("cvs" . jao-cvs-line) - ("none" . (lambda (p f) "")))) - (names (mapcar 'car formats)) - (prompt (concat "SCM (" (mapconcat 'identity names ", ") "): ")) - (sel (or jao-skels-default-scm - (completing-read prompt formats nil 1))) - (fun (cdr (assoc sel formats)))) - (when fun (concat (funcall fun prefix suffix))))) - -(defun jao-c&co-line (&optional prefix suffix) - (concat (jao-scm-line prefix suffix) "\n" - (jao-co-line prefix suffix))) - -(defun jao-co-line (&optional prefix suffix) - (concat (jao-copyright-line prefix suffix) "\n" - (jao-author-line prefix suffix) - (jao-date-line prefix suffix))) - -;; aux functions --------------------------------------------------------- -(defun jao-basename () - "Get buffer file name without dir nor extension" - (file-name-sans-extension (file-name-nondirectory (buffer-file-name)))) - -(defun jao-basedir () - "Base directory" - (file-name-nondirectory - (substring (file-name-directory (buffer-file-name)) 0 -1))) - -(defun jao-dir-level (l) - (let ((elems (split-string - (file-name-sans-extension (buffer-file-name)) "/"))) - (mapconcat 'identity (nthcdr (- (length elems) (+ 1 l)) elems) "/"))) - -(defun jao-extension () - "Find the extension of the currently visited file" - (let ((elems (split-string (file-name-nondirectory (buffer-file-name)) - "\\."))) - (nth (- (length elems) 1) elems))) - -(defun jao-other-file-name (ext1 ext2) - "Find the complimentary file name of header/source file" - (let ((extension (jao-extension)) - (basename (jao-basename))) - (if (string= extension ext1) (concat basename "." ext2) - (concat basename "." ext1)))) - -(defun jao-insert-commented-file (file-name) - (let* ((start (point)) - (end (+ start (cadr (insert-file-contents file-name))))) - (goto-char end) - (comment-region start (point)))) - -(defun jao-insert-copyright-file () - (let ((dir (locate-dominating-file (buffer-file-name) jao-copyright-file))) - (when dir - (let ((file (expand-file-name jao-copyright-file dir))) - (when (file-exists-p file) - (jao-insert-commented-file file)))))) - -(defun jao-provide-skel (regexp skel) - (let ((ex (assoc regexp auto-insert-alist))) - (if ex (setf (cdr ex) skel) - (add-to-list 'auto-insert-alist (cons regexp skel))))) - -(defsubst jao-skel-provide (lst) - (mapc (lambda (x) (apply #'jao-provide-skel x)) lst)) - -(provide 'common-skel) diff --git a/attic/skels/cpp-skel.el b/attic/skels/cpp-skel.el deleted file mode 100644 index 806f1df..0000000 --- a/attic/skels/cpp-skel.el +++ /dev/null @@ -1,255 +0,0 @@ -;;; cpp-skel.el - -;; Copyright (C) 2004, 2005, 2008, 2009 Jose Antonio Ortega Ruiz - -;; Author: Jose A Ortega Ruiz <jao@gnu.org> -;; Keywords: tools - -;; This file is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation; either version 3, or (at your option) -;; any later version. - -;; This file is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with GNU Emacs; see the file COPYING. If not, write to -;; the Free Software Foundation, Inc., 59 Temple Place - Suite 330, -;; Boston, MA 02111-1307, USA. - -;;; Commentary: - -;; C++ skeletons. - -;;; Code: - -(require 'common-skel) -(require 'thingatpt) - -;;; Variables -(defvar jao-skel-cpp-root-namespace nil - "The root C++ namespace") - -(defvar jao-skel-cpp-brief-header-p nil - "If non-nil, generate brief header comments") - -(defvar jao-skel-cpp-make-guard-function #'jao-skel-cpp-make-guard-name - "Function generating #include guards") - -(defvar jao-skel-cpp-use-namespaces t - "Whether to generate namespaces") - -(defvar jao-skel-cpp-single-line-namespaces t - "Whether to put consecutive namespace decls in a single line") - -(defvar jao-skel-cpp-header-extension "hpp") - -;;; Auxiliar functions -(defun jao-skel-cpp--find-other (ext) - (file-name-nondirectory - (or (ff-other-file-name) - (concat (file-name-sans-extension (buffer-name)) "." ext)))) - -(defun jao-skel-cpp-make-guard-name (ns) - "Create a standard include guard name" - (upcase (mapconcat #'identity - `(,@ns ,(jao-basename) ,(jao-extension) - ,(user-login-name) - ,(format-time-string "%y%m%d%H%M")) - "_"))) - -;; namespaces -(defsubst jao-skel-cpp--read-ns (curr) - (read-string (format "Add namespace (current: %s): " (or curr "[none]")))) - -(defsubst jao-skel-cpp--ns2str (ns) (mapconcat 'identity ns "::")) - -(defun jao-skel-cpp--get-ns-list (&optional acc) - (do* ((result acc (cons next result)) - (next (jao-skel-cpp--read-ns (jao-skel-cpp--ns2str acc)) - (jao-skel-cpp--read-ns (jao-skel-cpp--ns2str (reverse result))))) - ((string= next "") (reverse result)))) - -(defun jao-skel-cpp--insert-open-ns-list (ns) - (dolist (n ns) - (insert (format "namespace %s {%s" - n - (if jao-skel-cpp-single-line-namespaces " " "\n"))) - (indent-according-to-mode)) - (when jao-skel-cpp-single-line-namespaces - (newline) - (indent-according-to-mode))) - -(defun jao-skel-cpp--insert-close-ns-list (ns) - (if jao-skel-cpp-single-line-namespaces - (insert (format "%s // namespace %s\n" - (make-string (length ns) ?}) - (jao-skel-cpp--ns2str ns))) - (dolist (n (reverse ns)) - (insert (format "} // namespace %s\n" n))))) - -(defun jao-skel-cpp--copy-ns-lines () - (let ((lines)) - (save-excursion - (goto-char (point-min)) - (while (re-search-forward "namespace\\s-\\w+\\s-{\\|}+\\s-//\\s-namespace" - nil t) - (push (thing-at-point 'line) lines) - (next-line))) - lines)) - -(defun jao-skel-cpp--copy-namespace () - (let* ((name (ff-other-file-name)) - (buff (and name (find-file-noselect name))) - (nlines)) - (when buff - (let ((lines (save-current-buffer - (set-buffer buff) - (jao-skel-cpp--copy-ns-lines)))) - (dolist (line lines) - (push line nlines) - (when (string-match "}" line) - (push "\n\n\n\n" nlines))))) - (mapconcat #'identity nlines "\n"))) - -(defsubst jao-skel-cpp--get-new-namespace () - (when jao-skel-cpp-use-namespaces - (jao-skel-cpp--get-ns-list - (and jao-skel-cpp-root-namespace (list jao-skel-cpp-root-namespace))))) - -;; skeletons -(define-skeleton jao-skel-cpp-header-long - "Initial file header blurb" - "Brief file description: " - "/**" - > \n - "* @file " (file-name-nondirectory (buffer-file-name)) - > \n - "* @brief " str - > \n - "* @author " (user-full-name) " <"user-mail-address">" - > \n - "* @date " (format-time-string "%a %b %d, %Y %H:%M") - > \n - "*" - > \n - (jao-copyright-line "* " "") - "*" - > ?\n - (jao-insert-copyright-file) - > \n \n _) - -(define-skeleton jao-skel-cpp-header-brief - "Brief initial header blurb" - nil - (jao-copyright-line "/* " " */") - \n) - -(define-skeleton jao-skel-cpp-header-comment - "Insert a standard comment block" - nil - '(if jao-skel-cpp-brief-header-p - (jao-skel-cpp-header-brief) - (jao-skel-cpp-header-long))) - -;; source C/C++ file ------------------------------------------------------ -(define-skeleton jao-skel-cpp-source-header - "Insert a standard C++ source header" - nil - '(jao-skel-cpp-header-comment) - ? \n - "#include \"" (jao-skel-cpp--find-other jao-skel-cpp-header-extension) "\"" - > \n \n _ - (jao-skel-cpp--copy-namespace) - \n) - -(define-skeleton jao-skel-c-source-header - "Insert a standard C source header" - nil - '(jao-skel-cpp-header-comment) - "#include \"" (jao-skel-cpp--find-other "h") "\"" - > _ \n \n \n \n - (jao-scm-line "/* " " */") - > \n) - - -;; header C/C++ files ------------------------------------------------------ -;; header guard - -;; class definition -(define-skeleton jao-skel-cpp-class-def - "Insert a class definition" - nil - '(setq v1 (jao-basename)) - > \n - "/**" - > \n - "*" - > \n - "*" - > \n - "*/" - > \n - "class " v1 - > \n - "{" - > \n - "public:" - > \n - "~" v1 "();" - > \n - v1 "();" - > \n - v1 "(const " v1 "& other);" - > \n \n - "private:" - > \n - "};" - > \n) - -(define-skeleton jao-skel-cpp-header - "Insert a standard C++ header (hpp files)" - nil - '(setq v1 (jao-skel-cpp--get-new-namespace)) - '(setq v2 (funcall jao-skel-cpp-make-guard-function v1)) - '(jao-skel-cpp-header-comment) - > \n - "#ifndef " v2 - > \n - "#define " v2 - > \n \n - '(when v1 (jao-skel-cpp--insert-open-ns-list v1)) - _ '(jao-skel-cpp-class-def) - > \n \n - '(when v1 (jao-skel-cpp--insert-close-ns-list v1)) - > \n \n - "#endif // " v2 - > \n) - -(define-skeleton jao-skel-c-header - "Insert a standard C header (.h files)" - nil - '(jao-skel-cpp-header-comment) - > \n - '(setq v1 (funcall jao-skel-cpp-make-guard-function nil)) - "#ifndef " v1 - > \n - "#define " v1 - > _ \n \n \n \n - "#endif /* " v1 " */" - > \n \n - (jao-scm-line "/* " " */") - > \n) - -(jao-skel-provide - '(("\\.cpp$" jao-skel-cpp-source-header) - ("\\.hpp$" jao-skel-cpp-header) - ("\\.c$" jao-skel-c-source-header) - ("\\.h$" jao-skel-c-header))) - -(provide 'cpp-skel) - -;;; cpp-skel.el ends here diff --git a/attic/skels/cppunit-skel.el b/attic/skels/cppunit-skel.el deleted file mode 100644 index 729f392..0000000 --- a/attic/skels/cppunit-skel.el +++ /dev/null @@ -1,91 +0,0 @@ -;;; cppunit-skel.el - -;; Copyright (C) 2004, 2005 Jose Antonio Ortega Ruiz - -;; Author: Jose A Ortega Ruiz <jao@gnu.org> -;; Keywords: tools - -;; This file is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation; either version 2, or (at your option) -;; any later version. - -;; This file is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with GNU Emacs; see the file COPYING. If not, write to -;; the Free Software Foundation, Inc., 59 Temple Place - Suite 330, -;; Boston, MA 02111-1307, USA. - -;;; Commentary: - -;; Skeletons creating cppunit classes. - -;;; Code: - -(require 'common-skel) - -(define-skeleton jao-cppunit-main - "Insert CPPUNIT main function" - nil - "#include <cppunit/extensions/TestFactoryRegistry.h>" > \n - "#include <cppunit/ui/text/TestRunner.h>" > \n \n - "int" > \n - "main(int argc, char* argv[])" > \n - "{" > \n - "CppUnit::TextUi::TestRunner runner;" > \n - "CppUnit::TestFactoryRegistry& registry =" > \n - "CppUnit::TestFactoryRegistry::getRegistry();" > \n \n - "runner.addTest(registry.makeTest());" > \n \n - "return !runner.run(\"\", false);" > \n - "}" > \n) - -(define-skeleton jao-cppunit-class - "Create a CPPUNIT class definition preamble" - nil - > - "CPPUNIT_TEST_SUITE(" (jao-basename) ");" - > \n - "CPPUNIT_TEST(test);" - > \n - "CPPUNIT_TEST_SUITE_END();" - > \n \n - "private:" - > \n \n - "void test();" - > \n \n - "private:" - > \n \n - "void set_up();" - > \n - "void tear_down();" - > \n) - -(define-skeleton jao-cppunit-classdef - "Create a CPPUNIT class implementation preamble" - nil - > - "CPPUNIT_TEST_SUITE_REGISTRATION(" (jao-basename) ");" - > \n \n - "void" - > \n - (jao-basename) "::set_up()" - > \n - "{" - > \n - "}" - > \n \n - "void" - > \n - (jao-basename) "::tear_down()" - > \n - "{" - > \n - "}" - > \n) - -(provide 'cppunit-skel) - diff --git a/attic/skels/dot.emacs.el b/attic/skels/dot.emacs.el deleted file mode 100644 index a82e500..0000000 --- a/attic/skels/dot.emacs.el +++ /dev/null @@ -1,11 +0,0 @@ -;; boilerplate skels configuration: - -;;; add skels directory to your load path -(add-to-list 'load-path "~/lib/emacs/skels") -(load "init-skel") - -;;; set configuration variables -(setq jao-company-name "Free Software Foundation, Inc.") -(setq jao-cpp-root-namespace "") -(setq jao-copyright-file ".copyright") - diff --git a/attic/skels/fsf-copyright b/attic/skels/fsf-copyright deleted file mode 100644 index af83705..0000000 --- a/attic/skels/fsf-copyright +++ /dev/null @@ -1,12 +0,0 @@ -This file is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 3 of the License, or -(at your option) any later version. - -This file is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program. If not, see <http://www.gnu.org/licenses/>. diff --git a/attic/skels/fuel-skel.el b/attic/skels/fuel-skel.el deleted file mode 100644 index 786f4ec..0000000 --- a/attic/skels/fuel-skel.el +++ /dev/null @@ -1,45 +0,0 @@ -;;; fuel-skel.el --- skeleton for fuel elisp files - -;; Copyright (C) 2008 Jose Antonio Ortega Ruiz - -;; Author: Jose Antonio Ortega Ruiz <jao@gnu.org> -;; Keywords: lisp - -;; This program is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation, either version 3 of the License, or -;; (at your option) any later version. - -;; This program is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with this program. If not, see <http://www.gnu.org/licenses/>. - -;;; Code: - -(require 'common-skel) - -(define-skeleton jao-skel-fuel-file - "Fuel file header" - "Brief description: " - ";;; " (file-name-nondirectory (buffer-file-name)) " -- " str "" - \n \n - (jao-copyright-line ";; ") - ";; See http://factorcode.org/license.txt for BSD license." - \n \n (jao-author-line ";; ") ";; Keywords: languages, fuel, factor" - \n (jao-date-line ";; ") - \n ";;; Comentary: " \n \n ";; " _ \n - \n ";;; Code: " \n \n \n \n - "" \n "(provide '" (jao-basename) ")" \n - ";;; " (file-name-nondirectory (buffer-file-name)) " ends here" - \n - \n) - -(jao-provide-skel "misc/fuel/.+\\.el\\'" 'jao-skel-fuel-file) - - -(provide 'fuel-skel) -;;; fuel-skel.el ends here diff --git a/attic/skels/geiser-skel.el b/attic/skels/geiser-skel.el deleted file mode 100644 index 3c9181a..0000000 --- a/attic/skels/geiser-skel.el +++ /dev/null @@ -1,50 +0,0 @@ -;; geiser-skel.el -- geiser skeletons - -;; Copyright (C) 2009 Jose Antonio Ortega Ruiz - -;; Author: Jose Antonio Ortega Ruiz <jao@gnu.org> -;; Start date: Fri Sep 11, 2009 00:31 - -(require 'common-skel) - -(defconst jao-skel-geiser--bsd - ";; This program is free software; you can redistribute it and/or -;; modify it under the terms of the Modified BSD License. You should -;; have received a copy of the license along with this program. If -;; not, see <http://www.xfree86.org/3.3.6/COPYRIGHT2.html#5>. -") - -(defsubst jao-skel-geiser--end-line () - (format ";;; %s ends here\n\n" (file-name-nondirectory (buffer-file-name)))) - -(define-skeleton jao-skel-geiser--common - "Geiser elisp header" - "Brief description: " - ";;; " (file-name-nondirectory (buffer-file-name)) " -- " str "" - \n \n - (jao-copyright-line ";; ") \n - jao-skel-geiser--bsd - \n (jao-date-line ";; ") \n) - -(define-skeleton jao-skel-geiser-elisp - "Geiser elisp header" - nil - '(jao-skel-geiser--common) - "" \n _ \n \n "" \n "(provide '" (jao-basename) ")" \n - (jao-skel-geiser--end-line)) - -(jao-provide-skel "geiser/elisp/.+\\.el\\'" 'jao-skel-geiser-elisp) - -(define-skeleton jao-skel-geiser-scheme - "Geiser scheme header" - nil - '(jao-skel-geiser--common) _ - \n (jao-skel-geiser--end-line)) - -(jao-provide-skel "geiser/scheme/.+\\.\\(scm\\|ss\\|sls\\)\\'" - 'jao-skel-geiser-scheme) - - - -(provide 'geiser-skel) -;;; geiser-skel.el ends here diff --git a/attic/skels/haskell-skel.el b/attic/skels/haskell-skel.el deleted file mode 100644 index 8ea0301..0000000 --- a/attic/skels/haskell-skel.el +++ /dev/null @@ -1,70 +0,0 @@ -;;; haskell-skel.el --- skeleton for haskell source files -;; Copyright (C) 2003, 2004, 2005, 2009, 2010, 2012 Jose A Ortega Ruiz - -;; Author: Jose A Ortega Ruiz <jao@member.fsf.org> -;; Keywords: languages - -;; This file is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation; either version 3, or (at your option) -;; any later version. - -;; This file is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with GNU Emacs; see the file COPYING. If not, write to -;; the Free Software Foundation, Inc., 59 Temple Place - Suite 330, -;; Boston, MA 02111-1307, USA. - -;;; Commentary: - -;; - -;;; Code: - -(require 'common-skel) -(require 'jao-dominating-file) - -;;; Auxiliar -(defun jao-skel--read-haskell-module () - (let* ((ddir (jao-relative-path "\\.cabal\\'")) - (mbase (and ddir (concat (replace-regexp-in-string "/" "." ddir) - "."))) - (m (read-string "Module prefix (empty for no module): " - (concat (or mbase "") (jao-basename))))) - (or m ""))) - -(defconst jao-skel--haskell-line (make-string 78 ?-)) - -;;; Skeletons -(define-skeleton jao-skel-haskell-file - "Haskell hs file header" - "Brief description: " - '(setq v (jao-skel--read-haskell-module)) - jao-skel--haskell-line \n - "-- |" \n - "-- Module: " v \n - (jao-copyright-line "-- Copyright: " "" t) - "-- License: BSD3-style (see LICENSE)" \n - "--" \n - "-- Maintainer: " user-mail-address \n - "-- Stability: unstable" \n - "-- Portability: portable" \n - "-- Created: " (format-time-string "%a %b %d, %Y %H:%M") \n - "--" \n - "--" \n - "-- " str \n - "--" \n - jao-skel--haskell-line - \n \n \n - "module " v " where " \n \n \n) - -(jao-provide-skel "\\.hs\\'" 'jao-skel-haskell-file) -;; (jao-provide-skel "\\.lhs\\'" 'jao-skel-lit-haskell-file) - -(provide 'haskell-skel) - -;;; haskell-skel.el ends here diff --git a/attic/skels/init-skel.el b/attic/skels/init-skel.el deleted file mode 100644 index 7612f92..0000000 --- a/attic/skels/init-skel.el +++ /dev/null @@ -1,39 +0,0 @@ -;; skeleton configuration - -;; Copyright (C) 2004, 2005, 2006, 2007, 2008 Jose Antonio Ortega Ruiz - -;; Author: Jose A Ortega Ruiz <jao@gnu.org> -;; Keywords: tools - -;; This file is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation; either version 3, or (at your option) -;; any later version. - -;; This file is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with GNU Emacs; see the file COPYING. If not, write to -;; the Free Software Foundation, Inc., 59 Temple Place - Suite 330, -;; Boston, MA 02111-1307, USA. - -;;; Commentary: - -;; Initialisation file for jao skeletons - -;;; Code: - -(require 'autoinsert) -(setq auto-insert t) -(add-hook 'find-file-hooks 'auto-insert) -(setq auto-insert-directory "~/.autoinsert/") -(setq auto-insert-query t) - -(require 'common-skel) - -(provide 'init-skel) - -;;;; init-skel.el ends here diff --git a/attic/skels/latex-skel.el b/attic/skels/latex-skel.el deleted file mode 100644 index 330be22..0000000 --- a/attic/skels/latex-skel.el +++ /dev/null @@ -1,52 +0,0 @@ -;; latex skeletons - -;; Copyright (C) 2004, 2005, 2009 Jose Antonio Ortega Ruiz - -;; Author: Jose A Ortega Ruiz <jao@gnu.org> -;; Keywords: tools - -;; This file is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation; either version 3, or (at your option) -;; any later version. - -;; This file is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with GNU Emacs; see the file COPYING. If not, write to -;; the Free Software Foundation, Inc., 59 Temple Place - Suite 330, -;; Boston, MA 02111-1307, USA. - -;;; Commentary: - -;; LaTeX skeletons - -;;; Code: - -(require 'common-skel) - -(define-skeleton jao-skel-latex - "Latex standard header" - nil - "%%" - \n - "%% Author: " (user-full-name) " <"user-mail-address">" - \n - "%% Start date: " (format-time-string "%a %b %d, %Y %H:%M") - \n - "%% $" "Id$" - \n - "%%" - ?\n - (jao-copyright-line "% ") - \n - "%%" - \n \n) - -(jao-provide-skel "\\.tex$\\|\\.sty$\\|\\.cls$" 'jao-skel-latex) - -(provide 'latex-skel) - diff --git a/attic/skels/lisa-skel.el b/attic/skels/lisa-skel.el deleted file mode 100644 index 6cf3083..0000000 --- a/attic/skels/lisa-skel.el +++ /dev/null @@ -1,157 +0,0 @@ -;;; lisa variants of c skeletons - -;; Copyright (C) 2004, 2005, 2006 Jose Antonio Ortega Ruiz - -;; Author: Jose A Ortega Ruiz <jao@gnu.org> -;; Keywords: tools - -;; This file is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation; either version 2, or (at your option) -;; any later version. - -;; This file is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with GNU Emacs; see the file COPYING. If not, write to -;; the Free Software Foundation, Inc., 59 Temple Place - Suite 330, -;; Boston, MA 02111-1307, USA. - -;;; Commentary: - -;; Lisa variants for c skeletons - -;;; Code: - -(require 'common-skel) - -(defun jao-lisa-filename () - (let* ((fname (expand-file-name (buffer-file-name))) - (parts (split-string fname "/")) - (dirs (member "src" parts))) - (mapconcat 'identity dirs "/"))) - - -(defun jao-lisa-guard () - (upcase (concat (jao-basename) - "_" (jao-extension) "_" - (format-time-string "%y%m%d%H%M")))) - -(defun jao-lisa-header (&optional desc group prf) - (concat "/**" - "\n * @file " (jao-lisa-filename) - "\n * @author " (user-full-name) " <"user-mail-address">" - "\n * @date " (format-time-string "%a %b %d, %Y %H:%M") - "\n * @brief " (or desc (read-string "Description: ")) - (if group (concat "\n * @ingroup " group) "") - (if prf (concat "\n * @uutrx " prf) "") - "\n **/\n\n" - (jao-arch-line "// " ""))) - -(define-skeleton jao-skel-lisa-h - "Standard lisa c header" - nil - '(setq guard (jao-lisa-guard)) - (jao-lisa-header) - \n \n - "#ifndef " guard \n - "#define " guard \n - \n \n "#include \"" _ "\"" \n \n \n - "" \n "// Types" \n \n \n - "" \n "// Constants" \n \n \n - "" \n "// Functions" \n \n \n - \n \n - "#endif // " guard - \n \n) - -(define-skeleton jao-skel-lisa-c - "Standard lisa c body" - nil - (jao-lisa-header (concat (jao-other-file-name "h" "c") " implementation")) - \n \n - "#include \"" - (jao-basename) - ".h\"" > - > \n \n \n - "" \n "// Private" \n \n \n - _ - "" \n "// Public" \n \n \n - ) - -(define-skeleton jao-skel-lisa-test - "Cantata++ test file" - nil - '(setq v1 (read-string "File under test (sans extension): ")) - '(setq v0 (read-string "Doxygen group under test: ")) - '(setq v2 (concat "UnitTest" v0)) - (jao-lisa-header (concat "Unit tests for " v1) - v2 - (read-string "Prefix of functions being tested (e.g. 'rtos_?+'): ")) - \n \n - "#include \"test/test.h\"" > \n - "#include \"" v1 ".h\"" > \n \n \n - "// Test name" > \n - "char const *test_name = \"" (concat v1 "_test") "\";" > \n \n - "// Prototypes for test functions" > \n - "/**" \n - "* @defgroup " v2 " Unit tests" > \n - "* @ingroup " v0 > \n - "**/" > \n - "//@{" > \n - "//@}" > \n - \n \n \n - "void" > \n - "run_tests (void)" > \n - "{" > \n - "}" > \n \n - "// Test functions" > \n \n \n) - -(defun jao-add-cantata-test () - "Call this function inside a test buffer to add a new test fun" - (interactive) - (let* ((fn (read-string "Function under test: ")) - (tfn (concat "test_" fn))) - (goto-char (point-min)) - (if (not (search-forward-regexp "^// Prototypes for test functions$" nil t)) - (error "No beginning of test fun declarations found")) - (if (not (search-forward-regexp "//@\\}$" nil t)) - (error "Missing doxygen group marks in prototype function decls")) - (beginning-of-line) - (open-line 1) - (insert "/**\n * Unit tests for @ref " fn "\n */\n") - (insert "static void " tfn " (void);\n") - (if (not (search-forward-regexp "run_tests (void)$" nil t)) - (error "No run_tests() definition found")) - (if (not (search-forward-regexp "^}" nil t)) - (error "End of run_tests() not found")) - (beginning-of-line) - (insert "\n") - (previous-line 1) - (insert tfn " ();") - (indent-according-to-mode) - (goto-char (point-max)) - (jao-insert-cantata-test-fun tfn))) - -(defun jao-insert-cantata-test-fun (fn) - (beginning-of-line) - (insert "void\n" fn " (void)\n{\n") - (insert "START_TEST (\"" fn - "\", \"" (read-string "Test case description: ") "\");") - (indent-according-to-mode) - (insert "\n\n\nEND_TEST ();") - (indent-according-to-mode) - (insert "\n}\n")) - - -(defun jao-skel-lisa-activate () - (interactive) - (jao-provide-skel "\\.c$" 'jao-skel-lisa-c) - (jao-provide-skel "\\.h$" 'jao-skel-lisa-h) - (jao-provide-skel "tests/.*\\.c$" 'jao-skel-lisa-test)) - - -(provide 'lisa-skel) - diff --git a/attic/skels/lisp-skel.el b/attic/skels/lisp-skel.el deleted file mode 100644 index e5bb91a..0000000 --- a/attic/skels/lisp-skel.el +++ /dev/null @@ -1,50 +0,0 @@ -;;; lisp-skel.el --- skeleton for lisp-like languages - -;; Copyright (C) 2003, 2004, 2005, 2008, 2009 Jose A Ortega Ruiz - -;; Author: Jose A Ortega Ruiz <jao@gnu.org> -;; Keywords: lisp - -;; This file is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation; either version 3, or (at your option) -;; any later version. - -;; This file is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with GNU Emacs; see the file COPYING. If not, write to -;; the Free Software Foundation, Inc., 59 Temple Place - Suite 330, -;; Boston, MA 02111-1307, USA. - -;;; Commentary: - -;; Skeleton for lisp like languages - -;;; Code: - -(require 'common-skel) - -(define-skeleton jao-skel-lisp-file - "Lisp file header" - "Brief description: " - ";; " (file-name-nondirectory (buffer-file-name)) " -- " str "" - ?\n - (jao-c&co-line ";; ") - ?\n - (jao-insert-copyright-file) - \n ";;; Comentary: " \n \n ";; " _ \n - \n ";;; Code: " \n \n \n \n - '(when (eq major-mode 'emacs-lisp-mode) - (insert (format "\n(provide '%s)\n" (jao-basename)))) - ";;; " (file-name-nondirectory (buffer-file-name)) " ends here" - \n - \n) - -(jao-provide-skel "\\.\\(scm\\|ss\\|lisp\\|cl\\|el\\)\\'" 'jao-skel-lisp-file) - -(provide 'lisp-skel) -;;; lisp-skel.el ends here diff --git a/attic/skels/make-skel.el b/attic/skels/make-skel.el deleted file mode 100644 index 5607dbe..0000000 --- a/attic/skels/make-skel.el +++ /dev/null @@ -1,53 +0,0 @@ -;; makefile skeletons - -;; Copyright (C) 2004, 2005, 2009 Jose Antonio Ortega Ruiz - -;; Author: Jose A Ortega Ruiz <jao@gnu.org> -;; Keywords: tools - -;; This file is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation; either version 3, or (at your option) -;; any later version. - -;; This file is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with GNU Emacs; see the file COPYING. If not, write to -;; the Free Software Foundation, Inc., 59 Temple Place - Suite 330, -;; Boston, MA 02111-1307, USA. - -;;; Commentary: - -;; Makefile skeletons - -;;; Code: - -(require 'common-skel) - -(define-skeleton jao-skel-makefile - "Makefile standard header" - nil - "#" - \n - "# $" "Id$" - \n - "# " - \n - "# Author: " (user-full-name) " <"user-mail-address">" - \n - "# Start date: " (format-time-string "%a %b %d, %Y %H:%M") - \n - "#" - ?\n - (jao-copyright-line "# ") - \n - (jao-insert-copyright-file)) - -(jao-provide-skel "\\.mk$\\|Makefile\\(\\.am\\)?\\|configure\\.in" 'jao-skel-makefile) - -(provide 'make-skel) - diff --git a/attic/skels/muse-skel.el b/attic/skels/muse-skel.el deleted file mode 100644 index 86686d9..0000000 --- a/attic/skels/muse-skel.el +++ /dev/null @@ -1,41 +0,0 @@ -;;; muse-skel.el --- muse pages - -;; Copyright (C) 2006 Jose Antonio Ortega Ruiz - -;; Author: Jose Antonio Ortega Ruiz <jao@gnu.org> -;; Keywords: tools - -;; This file is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation; either version 2, or (at your option) -;; any later version. - -;; This file is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with GNU Emacs; see the file COPYING. If not, write to -;; the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, -;; Boston, MA 02110-1301, USA. - -;;; Code: - -(require 'common-skel) - -(define-skeleton jao-skel-muse-file - "Muse file skeleton" - "Documents (sub)dir: " - _ \n \n \n \n \n \n \n - "----" \n - ";;; Local Variables:" \n - ";;; wiki-docs: " str \n - ";;; End:" \n \n - '(hack-local-variables)) - -(add-to-list 'auto-insert-alist - '("\\.muse\\'" . jao-skel-muse-file)) - -(provide 'muse-skel) -;;; muse-skel.el ends here diff --git a/attic/skels/noweb-skel.el b/attic/skels/noweb-skel.el deleted file mode 100644 index 0e37702..0000000 --- a/attic/skels/noweb-skel.el +++ /dev/null @@ -1,48 +0,0 @@ -;;; noweb-skel.el --- skeleton for noweb files - -;; Copyright (C) 2003, 2004, 2005 Jose Antonio Ortega Ruiz - -;; Author: Jose A Ortega Ruiz <jao@gnu.org> -;; Keywords: tools - -;; This file is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation; either version 2, or (at your option) -;; any later version. - -;; This file is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with GNU Emacs; see the file COPYING. If not, write to -;; the Free Software Foundation, Inc., 59 Temple Place - Suite 330, -;; Boston, MA 02111-1307, USA. - -;;; Commentary: - -;; Skeleton for noweb files - -;;; Code: - -(require 'common-skel) -(require 'latex-skel) - -(define-skeleton jao-skel-noweb - "Noweb standard header" - "Code mode (without -mode suffix): " - "% -*- mode: Noweb; noweb-code-mode: " str "-mode -*-" - '(setq noweb-code-mode (intern (concat str "-mode"))) - \n - '(jao-skel-latex) - \n _ \n \n - "%%% end of file" - \n) - -(add-to-list 'auto-insert-alist '("\\.nw$" . jao-skel-noweb)) - -(provide 'noweb-skel) - - -;;; noweb-skel.el ends here diff --git a/attic/skels/perl-skel.el b/attic/skels/perl-skel.el deleted file mode 100644 index a5b5bb4..0000000 --- a/attic/skels/perl-skel.el +++ /dev/null @@ -1,78 +0,0 @@ -;;; perl-skel.el - -;; Copyright (C) 2004, 2005, 2009 Jose Antonio Ortega Ruiz - -;; Author: Jose A Ortega Ruiz <jao@gnu.org> -;; Keywords: tools - -;; This file is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation; either version 3, or (at your option) -;; any later version. - -;; This file is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with GNU Emacs; see the file COPYING. If not, write to -;; the Free Software Foundation, Inc., 59 Temple Place - Suite 330, -;; Boston, MA 02111-1307, USA. - -;;; Commentary: - -;; Perl skeletons - -;;; Code: - -(require 'common-skel) - -(define-skeleton jao-skel-perl-script - "Standard perl script header" - "Brief file description: " - "#! /usr/bin/perl -w" - > \n - "#" - > \n - "# $Id" "$" - > \n - "# " (file-name-nondirectory (buffer-file-name)) ": " str - > \n - "#" - > ?\n - (jao-copyright-line "# ") - > ?\n - (jao-insert-copyright-file) - > \n - "use strict;" - > \n \n - > \n _) - -(define-skeleton jao-skel-perl-module - "Standard perl module header" - "Brief module description: " - "#" - > \n - "# " (file-name-nondirectory (buffer-file-name)) ": "str - > \n - "#" - > ?\n - (jao-copyright-line "# ") - > ?\n - (jao-insert-copyright-file) - "# " - > \n \n - "package " - (read-string (concat "Module name (" (jao-basename) "): ") - nil nil (jao-basename)) - ";" - > \n \n _ \n \n - "1;" - > \n) - -(jao-provide-skel "\\.pl$" 'jao-skel-perl-script) -(jao-provide-skel "\\.pm$" 'jao-skel-perl-module) - -(provide 'perl-skel) - diff --git a/attic/skels/pika-skel.el b/attic/skels/pika-skel.el deleted file mode 100644 index 654792d..0000000 --- a/attic/skels/pika-skel.el +++ /dev/null @@ -1,88 +0,0 @@ -;;; pika variants of c skeletons - -;; Copyright (C) 2004, 2005 Jose Antonio Ortega Ruiz - -;; Author: Jose A Ortega Ruiz <jao@gnu.org> -;; Keywords: tools - -;; This file is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation; either version 2, or (at your option) -;; any later version. - -;; This file is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with GNU Emacs; see the file COPYING. If not, write to -;; the Free Software Foundation, Inc., 59 Temple Place - Suite 330, -;; Boston, MA 02111-1307, USA. - -;;; Commentary: - -;; Pika variants for c skeletons - -;;; Code: - -(require 'common-skel) - -(defun jao-pika-guard () - (upcase (concat "include__" (jao-basedir) "__" (jao-basename) "_h"))) - -(define-skeleton jao-pika-header - "" - "Brief file description: " - "/* " (file-name-nondirectory (buffer-file-name)) ": " str - \n "*" > \n - "****************************************************************" - > \n (jao-copyright-line "* ") - > \n "*" > \n - "* See the file \"COPYING\" for further information about" - > n - "* the copyright and warranty status of this work." - > n - "*/" \n "" \n _) - -(define-skeleton jao-skel-pika-h - "Standard pika c header" - nil - (jao-pika-header) - '(setq guard (jao-pika-guard)) - "#ifndef " guard \n - "#define " guard \n - "" - \n \n "#include \"" _ "\""\n \n - "" - \n \n \n - "" - \n - "#endif /* " guard " */" - \n \n "" \n - (jao-arch-line "/* " "*/") - \n) - -(define-skeleton jao-skel-pika-c - "Standard pika c body" - nil - (jao-pika-header) - \n "#include \"" (jao-dir-level 2) ".h\"" \n - \n - "" - \n \n _ \n \n "" \n - (jao-arch-line "/* " "*/") - \n) - -(defun jao-skel-pika-activate () - (interactive) - (let ((c (assoc "\\.c$" auto-insert-alist)) - (h (assoc "\\.h$" auto-insert-alist))) - (if c (setf (cdr c) 'jao-skel-pika-c) - (add-to-list 'auto-insert-alist '("\\.c$" . jao-skel-pika-c))) - (if h (setf (cdr h) 'jao-skel-pika-h) - (add-to-list 'auto-insert-alist '("\\.h$" . jao-skel-pika-h))))) - - -(provide 'pika-skel) - diff --git a/attic/skels/python-skel.el b/attic/skels/python-skel.el deleted file mode 100644 index 536f825..0000000 --- a/attic/skels/python-skel.el +++ /dev/null @@ -1,53 +0,0 @@ -;;; python-skel.el - -;; Copyright (C) 2004, 2005, 2009 Aleix Conchillo Flaque - -;; Author: Aleix Conchillo Flaque <aleix@member.fsf.org> -;; Keywords: tools - -;; This file is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation; either version 3, or (at your option) -;; any later version. - -;; This file is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with GNU Emacs; see the file COPYING. If not, write to -;; the Free Software Foundation, Inc., 59 Temple Place - Suite 330, -;; Boston, MA 02111-1307, USA. - -;;; Commentary: - -;; Python skeletons - -;;; Code: - -(require 'common-skel) - -(define-skeleton jao-skel-python-module - "Standard python module header" - "Brief file description: " - "#! /usr/bin/env python" - > \n - "#" - > \n - "# $Id" "$" - > \n \n - "# " (file-name-nondirectory (buffer-file-name)) ": " str - > \n - "#" - > ?\n - (jao-copyright-line "# ") - > ?\n - (jao-insert-copyright-file) - > \n - > \n _) - -(jao-provide-skel "\\.py$" 'jao-skel-python-module) - -(provide 'python-skel) - diff --git a/attic/skels/readme-skel.el b/attic/skels/readme-skel.el deleted file mode 100644 index 9c22cce..0000000 --- a/attic/skels/readme-skel.el +++ /dev/null @@ -1,44 +0,0 @@ -;; Copyright (C) 2004, 2005 Jose Antonio Ortega Ruiz - -;; Author: Jose A Ortega Ruiz <jao@gnu.org> -;; Keywords: tools - -;; This file is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation; either version 2, or (at your option) -;; any later version. - -;; This file is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with GNU Emacs; see the file COPYING. If not, write to -;; the Free Software Foundation, Inc., 59 Temple Place - Suite 330, -;; Boston, MA 02111-1307, USA. - -;;; Commentary: - -;; Simple skeleton for README files. - -;;; Code: - -(require 'common-skel) - -(define-skeleton jao-skel-readme-file - "README file header" - "Brief description: " - \n str - \n "-----------------------------------------------------" \n - _ \n \n \n - "-----------------------------------------------------" \n - (jao-copyright-line "" "") - \n \n - "$Id" "$" - \n) - -(add-to-list 'auto-insert-alist '("README" . jao-skel-readme-file)) - -(provide 'readme-skel) - diff --git a/attic/skels/s48-skel.el b/attic/skels/s48-skel.el deleted file mode 100644 index 30e749f..0000000 --- a/attic/skels/s48-skel.el +++ /dev/null @@ -1,61 +0,0 @@ -;;; s48-skel.el --- skeleton for s48 - -;; Copyright (C) 2003, 2004, 2005, 2006, 2008, 2009 Jose A Ortega Ruiz - -;; Author: Jose A Ortega Ruiz <jao@gnu.org> -;; Keywords: lisp - -;; This file is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation; either version 3, or (at your option) -;; any later version. - -;; This file is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with GNU Emacs; see the file COPYING. If not, write to -;; the Free Software Foundation, Inc., 59 Temple Place - Suite 330, -;; Boston, MA 02111-1307, USA. - -;;; Commentary: - -;; Skeleton for s48/slime48 like languages - -;;; Code: - -(require 'common-skel) -(require 'lisp-skel) - -(define-skeleton jao-skel-s48-file - "Slime/Scheme48 file header" - "Package: " - ";; -*- mode: scheme48; scheme48-package: " str " -*-" - ?\n - (jao-co-line ";; ") - ?\n - (jao-insert-copyright-file) - \n ";;; Comentary: " \n \n ";; " _ \n - \n ";;; Code: " \n \n \n \n - ";;; " (file-name-nondirectory (buffer-file-name)) " ends here" - '(scheme48-mode) - \n - \n) - -(define-skeleton jao-skel-s48-file-maybe - "Choose between a s48 file and a plain scheme one" - nil - '(if (y-or-n-p "Is this a s48 file? ") (jao-skel-s48-file) - (jao-skel-lisp-file)) - '(hack-local-variables)) - - -(jao-provide-skel "\\.scm\\'" 'jao-skel-s48-file-maybe) - - -(provide 's48-skel) - - -;;; lisp-skel.el ends here diff --git a/attic/skels/scsh-skel.el b/attic/skels/scsh-skel.el deleted file mode 100644 index 495925f..0000000 --- a/attic/skels/scsh-skel.el +++ /dev/null @@ -1,45 +0,0 @@ -;;; scsh-skel.el --- skeleton for scsh scripts - -;; Copyright (C) 2003, 2004, 2005, 2006, 2008 Jose Antonio Ortega Ruiz - -;; Author: Jose Antonio Ortega Ruiz <jao@gnu.org> -;; Keywords: abbrev - -;; This file is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation; either version 3, or (at your option) -;; any later version. - -;; This file is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with GNU Emacs; see the file COPYING. If not, write to -;; the Free Software Foundation, Inc., 59 Temple Place - Suite 330, -;; Boston, MA 02111-1307, USA. - -(require 'common-skel) - -(define-skeleton jao-skel-scsh - "Scsh script skeleton" - "Brief description: " - "#! " (executable-find "scsh") " \\" \n - "-e " (file-name-nondirectory (buffer-file-name)) " -s" \n - "!#" \n \n - ";;;; " str \n - "(define (" (file-name-nondirectory (buffer-file-name)) " args)" - \n - > _ " )" - > \n \n \n - ";; Local Variables:" \n - ";; mode: scheme" \n - ";; End:" - '(hack-local-variables) - \n \n) - -(provide 'scsh-skel) - - -;;; scsh-skel.el ends here diff --git a/attic/skels/texinfo-skel.el b/attic/skels/texinfo-skel.el deleted file mode 100644 index dc73835..0000000 --- a/attic/skels/texinfo-skel.el +++ /dev/null @@ -1,131 +0,0 @@ -;;; texinfo-skel.el --- skeletons for texinfo files - -;; Author: Jose Antonio Ortega Ruiz <jao@gnu.org> -;; Keywords: languages - -;; This file is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation; either version 2, or (at your option) -;; any later version. - -;; This file is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with GNU Emacs; see the file COPYING. If not, write to -;; the Free Software Foundation, Inc., 59 Temple Place - Suite 330, -;; Boston, MA 02111-1307, USA. - -;;; Commentary: - -;; Skeletons to generate texinfo files templates. - -;;; Code: - -(require 'common-skel) - -(defun jao-dir-entry () - "Read dir file entry" - (let ((cat (read-string "Dir file category: ")) - (ent (read-string "Direntry name: ")) - (desc (read-string "Direntry description: "))) - (concat "@dircategory " cat - "\n@direntry\n" ent - ": (" (jao-basename) "). " desc "." - "\n@end direntry\n"))) - -(define-skeleton jao-skel-main-texinfo - "Main texinfo file skeleton" - "Document title: " - "\\input texinfo" - \n "@ignore" > - \n (jao-scm-line "") - "@end ignore" > - \n > "@c %**start of header" - \n "@setfilename " (jao-basename) ".info" > - \n "@settitle " str > - \n "@syncodeindex pg cp" > - \n "@setchapternewpage odd" > - \n "@footnotestyle separate" > - \n "@c %**end of header" > - \n \n - (jao-dir-entry) - \n - "@set UPDATED " (format-time-string "%B %Y") - \n "@set EDITION 0.1" - \n "@set VERSION 0.1" - \n "@set AUTHOR " (user-full-name) - \n \n "@copying" - \n "This manual is for " str " (version @value{VERSION}, @value{UPDATED})." - \n - \n "Copyright @copyright{} " (format-time-string "%Y") " " jao-company-name - \n - \n "@quotation" - \n "Permission is granted to copy, distribute and/or modify this document" - \n "under the terms of the GNU Free Documentation License, Version 1.1 or" - \n "any later version published by the Free Software Foundation; with no" - \n "Invariant Sections, with the Front-Cover Texts being ``A GNU Manual,''" - \n "and with the Back-Cover Texts as in (a) below. A copy of the" - \n "license is included in the section entitled ``GNU Free Documentation" - \n "License.''" - \n - \n "(a) The FSF's Back-Cover Text is: ``You have freedom to copy and modify" - \n "this GNU Manual, like GNU software. Copies published by the Free" - \n "Software Foundation raise funds for GNU development.''" - \n "@end quotation" - \n "@end copying" - \n \n "@titlepage" - \n "@title " str - \n "@subtitle Edition @value{EDITION}, for version @value{VERSION}" - \n "@subtitle @value{UPDATED}" - \n "@author by @value{AUTHOR} (@email{jao@@gnu.org})" - \n "@page" - \n "@vskip 0pt plus 1filll" - \n "@insertcopying" - \n "@end titlepage" - \n - \n "@shortcontents" - \n "@contents" - \n - \n "@ifnottex" - \n "@node Top, , (dir), (dir)" - \n \n "@insertcopying" - \n "@end ifnottex" - \n \n - "@menu" > \n "@detailmenu" \n \n > "@end detailmenu" > \n "@end menu" - \n \n \n - "@include intro.texi" > - \n \n \n - "@bye" - \n) - -(define-skeleton jao-skel-child-texinfo - "Template for child texinfo docs" - "Node name: " - "@node " str \n - > "@chapter " str \n - > "@ignore" \n - (jao-scm-line "") - > "@end ignore" \n \n - _ \n \n - "@c This is part of the " (read-string "Main doc title: ") \n - "@c See the main file for copying conditions." - \n \n) - -(define-skeleton jao-skel-texinfo - "Skeleton for texinfo files" - nil - '(if (y-or-n-p "Is this the main texinfo file? ") - (jao-skel-main-texinfo) - (jao-skel-child-texinfo)) - _) - -(add-to-list 'auto-insert-alist '("\\.texi$" . jao-texinfo-skel)) - - -(provide 'texinfo-skel) - - -;;; texinfo-skel.el ends here |