;; -*- coding: utf-8 -*- ;; part of Xah Lee's emacs init file. ;; 2011-05-28 ;; Xah Lee ;; ∑ http://xahlee.org/ (defun xah-add-to-related-links (sourceFile destFile) "Add current file as a link to the related links section of filename at point. When called in lisp program, the arguments should all be absolute path." (interactive (let (bds p1 p2) (setq bds (get-selection-or-unit 'line)) (setq p1 (elt bds 1) ) (setq p2 (elt bds 2) ) (list buffer-file-name (expand-file-name (thing-at-point 'filename))) ) ) (let (p3 p4 ξtitle sourceFileRelativePath (linkFound-p nil) ) (find-file destFile ) (goto-char 1) (setq sourceFileRelativePath (file-relative-name sourceFile (file-name-directory destFile) ) ) (if (search-forward sourceFileRelativePath nil t) (setq linkFound-p t) (setq linkFound-p nil) ) (if (not linkFound-p) (progn (setq ξtitle (get-html-file-title sourceFile)) (goto-char 1) (if (search-forward "