diff lisp/w3/w3-hot.el @ 70:131b0175ea99 r20-0b30

Import from CVS: tag r20-0b30
author cvs
date Mon, 13 Aug 2007 09:02:59 +0200
parents e04119814345
children 1ce6082ce73f
line wrap: on
line diff
--- a/lisp/w3/w3-hot.el	Mon Aug 13 09:00:04 2007 +0200
+++ b/lisp/w3/w3-hot.el	Mon Aug 13 09:02:59 2007 +0200
@@ -1,14 +1,13 @@
 ;;; w3-hot.el --- Main functions for emacs-w3 on all platforms/versions
 ;; Author: wmperry
-;; Created: 1997/03/11 15:04:05
-;; Version: 1.13
+;; Created: 1996/07/26 05:22:59
+;; Version: 1.5
 ;; Keywords: faces, help, comm, news, mail, processes, mouse, hypermedia
 
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;;; Copyright (c) 1993 - 1996 by William M. Perry (wmperry@cs.indiana.edu)
-;;; Copyright (c) 1996, 1997 Free Software Foundation, Inc.
 ;;;
-;;; This file is part of GNU Emacs.
+;;; This file is not part of GNU Emacs, but the same permissions apply.
 ;;;
 ;;; GNU Emacs is free software; you can redistribute it and/or modify
 ;;; it under the terms of the GNU General Public License as published by
@@ -21,9 +20,8 @@
 ;;; 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.
+;;; along with GNU Emacs; see the file COPYING.  If not, write to
+;;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
@@ -73,7 +71,7 @@
     (insert-file-contents fname)
     (let* ((w3-debug-html nil)
 	   (bkmarks nil)
-	   (parse (w3-parse-buffer (current-buffer))))
+	   (parse (w3-parse-buffer (current-buffer) t)))
       (setq parse w3-last-parse-tree
 	    bkmarks (nreverse (w3-grok-html-bookmarks parse))
 	    w3-html-bookmarks bkmarks)))
@@ -160,7 +158,7 @@
 	  (progn
 	    (w3-show-hotlist)
 	    (rename-buffer (concat "Hotlist \"" regexp "\""))
-	    (url-set-filename url-current-object (concat "hotlist/" regexp)))
+	    (setq url-current-file (concat "hotlist/" regexp)))
 	(and save-buf (save-excursion
 			(set-buffer save-buf)
 			(rename-buffer "Hotlist")))))))
@@ -168,7 +166,8 @@
 (defun w3-hotlist-refresh ()
   "Reload the default hotlist file into memory"
   (interactive)
-  (w3-parse-hotlist))
+  (w3-parse-hotlist)
+  (if (fboundp 'w3-add-hotlist-menu) (w3-add-hotlist-menu)))
 
 (defun w3-delete-from-alist (x alist)
   ;; Remove X from ALIST, return new alist
@@ -204,7 +203,8 @@
 		(write-file w3-hotlist-file)
 		(setq w3-hotlist (w3-delete-from-alist title w3-hotlist))
 		(kill-buffer (current-buffer)))
-	    (message "%s was not found in %s" title w3-hotlist-file)))))))
+	    (message "%s was not found in %s" title w3-hotlist-file))))))
+  (and (fboundp 'w3-add-hotlist-menu) (funcall 'w3-add-hotlist-menu)))
 
 (defun w3-hotlist-rename-entry (title)
   "Rename a hotlist item"
@@ -246,14 +246,16 @@
 		(progn
 		  (delete-menu-item '("Go"))
 		  (w3-build-FSF19-menu))))
-	(message "%s was not found in %s" title w3-hotlist-file)))))
+	(message "%s was not found in %s" title w3-hotlist-file))))
+  (and (fboundp 'w3-add-hotlist-menu) (funcall 'w3-add-hotlist-menu)))
 
 (defun w3-hotlist-append (fname)
   "Append a hotlist to the one in memory"
   (interactive "fAppend hotlist file: ")
   (let ((x w3-hotlist))
     (w3-parse-hotlist fname)
-    (setq w3-hotlist (nconc x w3-hotlist))))
+    (setq w3-hotlist (nconc x w3-hotlist))
+    (and (fboundp 'w3-add-hotlist-menu) (funcall 'w3-add-hotlist-menu))))
 
 (defun w3-hotlist-parse-old-mosaic-format ()
   (let (cur-link cur-alias)
@@ -270,7 +272,9 @@
 					  (end-of-line)
 					  (point))))
       (if (not (equal cur-alias ""))
-	  (setq w3-hotlist (cons (list cur-alias cur-link) w3-hotlist))))))
+	  (setq w3-hotlist (cons (list cur-alias cur-link) w3-hotlist)))
+      (if (fboundp 'w3-add-hotlist-menu)
+	  (funcall 'w3-add-hotlist-menu)))))
 
 (defun w3-parse-hotlist (&optional fname)
   "Read in the hotlist specified by FNAME"
@@ -316,15 +320,16 @@
 (defun w3-hotlist-add-document-at-point (pref-arg)
   "Add the document pointed to by the hyperlink under point to the hotlist."
   (interactive "P")
-  (let ((url (w3-view-this-url t))
-	(widget (widget-at (point)))
-	(title nil))
+  (let ((url (w3-view-this-url t)) title)
     (or url (error "No link under point."))
-    (if (and (widget-get widget :from)
-	     (widget-get widget :to))
-	(setq title (buffer-substring (widget-get widget :from)
-				      (widget-get widget :to))))
-    (w3-hotlist-add-document pref-arg (or title url) url)))
+    (setq title (get-text-property (point) 'title))
+    (if (and title
+	     (marker-buffer (car title))
+	     (marker-buffer (cdr title)))
+	(setq title (buffer-substring-no-properties (car title) (cdr title)))
+      (setq title "None"))
+    (w3-hotlist-add-document pref-arg title url)
+    (and (fboundp 'w3-add-hotlist-menu) (funcall 'w3-add-hotlist-menu))))
 
 (defun w3-hotlist-add-document (pref-arg &optional the-title the-url)
   "Add this documents url to the hotlist"
@@ -353,8 +358,10 @@
 	  (insert-file-contents w3-hotlist-file)
 	  (goto-char (point-max))
 	  (backward-char 1)))
-      (insert "\n" url " " (current-time-string) "\n" title)
+      (insert "\n" (url-hexify-string url) " " (current-time-string)
+		 "\n" title)
       (write-file w3-hotlist-file)
-      (kill-buffer (current-buffer)))))
+      (kill-buffer (current-buffer))))
+      (and (fboundp 'w3-add-hotlist-menu) (funcall 'w3-add-hotlist-menu)))
 
 (provide 'w3-hot)