⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 browse-url-for-emacs-19.28.el

📁 namazu. 虽然是日语的,也适用于文件中单词索引后全文检索.
💻 EL
📖 第 1 页 / 共 2 页
字号:
Used by the `browse-url-of-file' command.")(defvar browse-url-save-file nil  "If non-nil, save the buffer before displaying its file.Used by the `browse-url-of-file' command.")(defvar browse-url-of-file-hook nil  "A hook to be run with run-hook after `browse-url-of-file' has askeda browser to load a file.Set this to `browse-url-netscape-reload' to force Netscape to load thefile rather than displaying a cached copy.")(defvar browse-url-usr1-signal  (if (and (boundp 'emacs-major-version)	   (or (> emacs-major-version 19) (>= emacs-minor-version 29)))      'sigusr1    30)					; Check /usr/include/signal.h.  "The argument to `signal-process' for sending SIGUSR1 to XMosaic.Emacs 19.29 accepts 'sigusr1, earlier versions require an integerwhich is 30 on SunOS and 16 on HP-UX and Solaris.")(defvar browse-url-CCI-port 3003  "Port to access XMosaic via CCI.This can be any number between 1024 and 65535 but must correspond tothe value set in the browser.");;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; URL input;; thingatpt.el doesn't work for complex regexps.(defun browse-url-url-at-point ()  "Return the URL around or before point.Then search backwards for the start of a URL.  If no URL found, returnthe empty string."  (if (or (looking-at browse-url-regexp)	; Already at start	  (let ((eol (save-excursion (end-of-line) (point))))	    ;; Search forwards for the next URL or end of line in case	    ;; we're in the middle of one.	    (and (re-search-forward browse-url-regexp eol 'lim)		 (goto-char (match-beginning 0)))	    ;; Now back to where we started or earlier.	    (re-search-backward browse-url-regexp nil t)))      (buffer-substring (match-beginning 0) (match-end 0))    ""))				; No match;; Todo: restrict to around or immediately before point.  Expand bare;; hostname to URL.(defun browse-url-interactive-arg (&optional prompt)  "Read a URL from the minibuffer, optionally prompting with PROMPT.Default to the URL at or before point.  If bound to a mouse button,set point to the position clicked.  Return the result as a list foruse in `interactive'."  (let ((event (elt (this-command-keys) 0)))    (and (listp event) (mouse-set-point event)))  (list (read-string (or prompt "URL: ") (browse-url-url-at-point))))(defun browse-url-at-point ()  "Ask a WWW browser to load the URL at or before point.The URL is loaded according to the value of `browse-url-browser-function'."  (interactive)  (funcall browse-url-browser-function (browse-url-url-at-point)))(defun browse-url-at-mouse (event)  "Ask a WWW browser to load a URL clicked with the mouse.The URL is the one around or before the position of the mouse clickbut point is not changed.  The URL is loaded according to the value of`browse-url-browser-function'."  (interactive "e")  (save-excursion    (let ((posn (event-start event)))      (set-buffer (window-buffer (posn-window posn)))      (goto-char (posn-point posn))      (let ((url (browse-url-url-at-point)))	(if (string-equal url "")	    (error "No URL found"))	(funcall browse-url-browser-function url)))));;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Browse current buffer(defun browse-url-of-file (&optional file)  "Ask a WWW browser to display FILE.Display the current buffer's file if FILE is nil or if calledinteractively.  Turn the filename into a URL by performingreplacements given in variable `browse-url-filename-alist'.  Pass theURL to a browser using variable `browse-url-browser-function' then run`browse-url-of-file-hook'."  (interactive)  (setq file	(or file	    (buffer-file-name)	    (error "Current buffer has no file")))  (let ((buf (get-file-buffer file)))    (if buf	(save-excursion	  (set-buffer buf)	  (cond ((not (buffer-modified-p)))		(browse-url-save-file (save-buffer))		(t (message "%s modified since last save" file))))))  (funcall browse-url-browser-function (browse-url-file-url file))  (run-hooks 'browse-url-of-file-hook))(defun browse-url-file-url (file)  "Return the URL corresponding to FILE.Uses variable `browse-url-filename-alist' to map filenames to URLs."  (let ((maps browse-url-filename-alist))    (while maps      (let* ((map (car maps))	     (from-re (car map))	     (to-string (cdr map)))	(setq maps (cdr maps))	(if (string-match from-re file)	    (setq file (concat (substring file 0 (match-beginning 0))			       to-string			       (substring file (match-end 0))))))))  file)(defvar browse-url-temp-file-name nil)(make-variable-buffer-local 'browse-url-temp-file-name)(defvar browse-url-temp-file-list '())(defun browse-url-of-buffer (&optional buffer)  "Ask a WWW browser to display BUFFER.Display the current buffer if BUFFER is nil."  (interactive)  (save-excursion    (set-buffer (or buffer (current-buffer)))    (let ((file-name	   (or buffer-file-name	       (and (boundp 'dired-directory) dired-directory))))      (if (null file-name)	  (progn	    (if (null browse-url-temp-file-name)		(progn		  (setq browse-url-temp-file-name			(make-temp-name			 (expand-file-name (buffer-name)					   (or (getenv "TMPDIR") "/tmp"))))		  (setq browse-url-temp-file-list			(cons browse-url-temp-file-name			      browse-url-temp-file-list))))	    (write-region (point-min) (point-max) browse-url-temp-file-name			  nil 'no-message)))      (browse-url-of-file (or file-name browse-url-temp-file-name)))))(defun browse-url-delete-temp-file (&optional temp-file-name)  ;; Delete browse-url-temp-file-name from the file system and from  ;; browse-url-temp-file-list.  If optional arg TEMP-FILE-NAME is  ;; non-nil, delete it instead, but only from the file system --  ;; browse-url-temp-file-list is not affected.  (let ((file-name (or temp-file-name browse-url-temp-file-name)))    (if (and file-name (file-exists-p file-name))	(progn	  (delete-file file-name)	  (if (null temp-file-name)	      (setq browse-url-temp-file-list		    (delete browse-url-temp-file-name			    browse-url-temp-file-list)))))))(defun browse-url-delete-temp-file-list ()  ;; Delete all elements of browse-url-temp-file-list.  (while browse-url-temp-file-list    (browse-url-delete-temp-file (car browse-url-temp-file-list))    (setq browse-url-temp-file-list	  (cdr browse-url-temp-file-list))))(add-hook 'kill-buffer-hook 'browse-url-delete-temp-file)(add-hook 'kill-emacs-hook 'browse-url-delete-temp-file-list)(defun browse-url-of-dired-file ()  "In Dired, ask a WWW browser to display the file named on this line."  (interactive)  (browse-url-of-file (dired-get-filename)));;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Browser-specific functions(defun browse-url-netscape (url &optional new-window)  "Ask the Netscape WWW browser to load URL.Default to the URL around or before point.  The strings in variable`browse-url-netscape-arguments' are also passed to Netscape.When called interactively, if variable `browse-url-new-window-p' isnon-nil, load the document in a new Netscape window, otherwise use arandom existing one.  A non-nil interactive prefix argument reversesthe effect of browse-url-new-window-p.When called non-interactively, optional second argument NEW-WINDOW isused instead of browse-url-new-window-p."  (interactive (append (browse-url-interactive-arg "Netscape URL: ")		       (list (not (eq (null browse-url-new-window-p)				      (null current-prefix-arg))))))  (or (zerop       (apply 'call-process "netscape" nil nil nil	      (append browse-url-netscape-arguments		      (if new-window '("-noraise"))		      (list "-remote" 			    (concat "openURL(" url 				    (if new-window ",new-window")				    ")")))))      (progn				; Netscape not running - start it	(message "Starting Netscape...")	(apply 'start-process "netscape" nil "netscape"	       (append browse-url-netscape-arguments (list url))))))(defun browse-url-netscape-reload ()  "Ask Netscape to reload its current document."  (interactive)  (browse-url-netscape-command "reload"))(defun browse-url-netscape-command (command)  "Send a remote control command to Netscape."  (apply 'start-process "netscape" nil "netscape"	 (append browse-url-netscape-arguments		 (list "-remote" command))))(defun browse-url-mosaic (url)  "Ask the XMosaic WWW browser to load URL.Default to the URL around or before point."  (interactive (browse-url-interactive-arg "Mosaic URL: "))  (let ((pidfile (expand-file-name "~/.mosaicpid"))	pid pidbuf)    (if (file-readable-p pidfile)	(save-excursion	  (find-file pidfile)	  (goto-char (point-min))	  (setq pid (read (current-buffer)))	  (kill-buffer nil)))    (if (and pid (zerop (signal-process pid 0))) ; Mosaic running	(save-excursion	  (find-file (format "/tmp/Mosaic.%d" pid))	  (erase-buffer)	  (insert "goto\n" url "\n")	  (save-buffer)	  (kill-buffer nil)	  ;; Send signal SIGUSR to Mosaic	  (message "Signalling Mosaic...")	  (signal-process pid browse-url-usr1-signal)	  ;; Or you could try:	  ;; (call-process "kill" nil 0 nil "-USR1" (int-to-string pid))	  )      ;; Mosaic not running - start it      (message "Starting Mosaic...")      (apply 'start-process "xmosaic" nil "xmosaic"	     (append browse-url-mosaic-arguments (list url))))))(defun browse-url-cci (url &optional new-window)  "Ask the XMosaic WWW browser to load URL.Default to the URL around or before point.This function only works for XMosaic version 2.5 or later.  You mustselect `CCI' from XMosaic's File menu, set the CCI Port Address to thevalue of variable `browse-url-CCI-port', and enable `Accept requests'.When called interactively, if variable `browse-url-new-window-p' isnon-nil, load the document in a new browser window, otherwise use arandom existing one.  A non-nil interactive prefix argument reversesthe effect of browse-url-new-window-p.When called non-interactively, optional second argument NEW-WINDOW isused instead of browse-url-new-window-p."  (interactive (append (browse-url-interactive-arg "Mosaic URL: ")		       (list (not (eq (null browse-url-new-window-p)				      (null current-prefix-arg))))))  (open-network-stream "browse-url" " *browse-url*"		       "localhost" browse-url-CCI-port)  ;; Todo: start browser if fails  (process-send-string "browse-url"		       (concat "get url (" url ") output "			       (if new-window "new" "current") "\r\n"))  (process-send-string "browse-url" "disconnect\r\n")  (delete-process "browse-url"))(defun browse-url-iximosaic (url)  "Ask the IXIMosaic WWW browser to load URL.Default to the URL around or before point."  (interactive (browse-url-interactive-arg "IXI Mosaic URL: "))  (start-process "tellw3b" nil "tellw3b"		 "-service WWW_BROWSER ixi_showurl " url))(defun browse-url-w3 (url)  "Ask the w3 WWW browser to load URL.Default to the URL around or before point."  (interactive (browse-url-interactive-arg "W3 URL: "))  (w3-fetch url))(provide 'browse-url);;; browse-url.el ends here

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -