diff options
author | Aaron M. Ucko <ucko@debian.org> | 2019-01-10 21:50:08 -0500 |
---|---|---|
committer | Aaron M. Ucko <ucko@debian.org> | 2019-01-10 21:50:08 -0500 |
commit | 3b7fd5450e58de1afdef922034e28b4e1e73673e (patch) | |
tree | 8e926a9858f24bfffc111922967579e09b0601a9 | |
parent | 8713ba9aade976ab6559795a2706de6a2dac6b57 (diff) | |
parent | 79a0c9a7702cc74da91452cdb324a0956172c660 (diff) |
Merge tag 'upstream/1.10+git20190107' (#864644).
Upstream version (snapshot) 1.10+git20190107, incorporating most previous
outstanding Debian changes and adding among other things support for custom
definition body faces, preferably variable-width. (Closes: #864644.)
-rw-r--r--[-rwxr-xr-x] | GPL | 0 | ||||
-rw-r--r--[-rwxr-xr-x] | Makefile | 0 | ||||
-rw-r--r--[-rwxr-xr-x] | README | 3 | ||||
-rw-r--r--[-rwxr-xr-x] | connection.el | 24 | ||||
-rw-r--r-- | deb/README.debian | 2 | ||||
-rw-r--r-- | deb/compat | 1 | ||||
-rw-r--r-- | deb/control | 2 | ||||
-rw-r--r-- | debian/changelog | 9 | ||||
-rw-r--r--[-rwxr-xr-x] | dictionary-init.el | 0 | ||||
-rw-r--r--[-rwxr-xr-x] | dictionary.el | 132 | ||||
-rw-r--r--[-rwxr-xr-x] | install-package.el | 0 | ||||
-rw-r--r--[-rwxr-xr-x] | link.el | 61 | ||||
-rw-r--r--[-rwxr-xr-x] | lpath.el | 0 |
13 files changed, 144 insertions, 90 deletions
@@ -638,6 +638,3 @@ Version 1.0 - 1.1 * fixed bug with going to the previous link * replaced word-at-point by current-word _________________________________________________________________ - - E-Mail: dictionary@myrkr.in-berlin.de - Last modified: Fri Dec 21 18:51:23 CET 2001 diff --git a/connection.el b/connection.el index 6df78d6..85eac27 100755..100644 --- a/connection.el +++ b/connection.el @@ -1,7 +1,8 @@ -;;; connection.el -- handling a tcp based connection +;;; connection.el --- TCP-based client connection -;; Author: Torsten Hilbrich <dictionary@myrkr.in-berlin.de> +;; Author: Torsten Hilbrich <torsten.hilbrich@gmx.net> ;; Keywords: network +;; Version: 1.10 ;; 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 @@ -18,6 +19,15 @@ ;; the Free Software Foundation, Inc., 59 Temple Place - Suite 330, ;; Boston, MA 02111-1307, USA. +;;; Commentary: + +;; connection allows to handle TCP-based connections in client mode +;; where text-based information are exchanged. There is special +;; support for handling CR LF (and the usual CR LF . CR LF +;; terminater). + +;;; Code: + (eval-when-compile (require 'cl)) @@ -66,8 +76,7 @@ A data structure identifing the connection is returned" server port))) (process)) - (save-excursion - (set-buffer process-buffer) + (with-current-buffer process-buffer (setq process (open-network-stream "connection" process-buffer server port)) (connection-create-data process-buffer process (point-min))))) @@ -110,8 +119,7 @@ nil: argument is no connection object "Send `data' to the process." (unless (eq (connection-status connection) 'up) (error "Connection is not up")) - (save-excursion - (set-buffer (connection-buffer connection)) + (with-current-buffer (connection-buffer connection) (goto-char (point-max)) (connection-set-read-point connection (point)) (process-send-string (connection-process connection) data))) @@ -126,8 +134,7 @@ nil: argument is no connection object (error "Connection is not up")) (let ((case-fold-search nil) match-end) - (save-excursion - (set-buffer (connection-buffer connection)) + (with-current-buffer (connection-buffer connection) (goto-char (connection-read-point connection)) ;; Wait until there is enough data (while (not (search-forward-regexp delimiter nil t)) @@ -149,3 +156,4 @@ nil: argument is no connection object (connection-read connection "\015?\012[.]\015?\012")) (provide 'connection) +;;; connection.el ends here diff --git a/deb/README.debian b/deb/README.debian index d5bf0de..3b8cb63 100644 --- a/deb/README.debian +++ b/deb/README.debian @@ -11,4 +11,4 @@ package. Instructions on using this package can be found in the /usr/share/doc/dictionary/README.gz file or in the above location. -Torsten Hilbrich <dictionary@myrkr.in-berlin.de>, Sun, 13 May 2001 09:55:20 +0200 +Torsten Hilbrich <torsten.hilbrich@gmx.net>, Sun, 13 May 2001 09:55:20 +0200 diff --git a/deb/compat b/deb/compat deleted file mode 100644 index ec63514..0000000 --- a/deb/compat +++ /dev/null @@ -1 +0,0 @@ -9 diff --git a/deb/control b/deb/control index b1010c1..ab6fcd3 100644 --- a/deb/control +++ b/deb/control @@ -1,7 +1,7 @@ Source: dictionary Section: unofficial Priority: optional -Maintainer: Torsten Hilbrich <dictionary@myrkr.in-berlin.de> +Maintainer: Torsten Hilbrich <torsten.hilbrich@gmx.net> Build-Depends: dpkg-dev Standards-Version: 3.2.1 diff --git a/debian/changelog b/debian/changelog index 0a90b6e..162a7fd 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,12 @@ +dictionary-el (1.10+git20190107-1) UNRELEASED; urgency=medium + + * NOT RELEASED YET. + * New upstream snapshot, incorporating most previous outstanding Debian + changes and adding among other things support for custom definition + body faces, preferably variable-width. (Closes: #864644.) + + -- Aaron M. Ucko <ucko@debian.org> Thu, 10 Jan 2019 21:50:06 -0500 + dictionary-el (1.10-3) unstable; urgency=medium * debian/control: Canonicalize per cme. In particular, declare diff --git a/dictionary-init.el b/dictionary-init.el index 7f430f2..7f430f2 100755..100644 --- a/dictionary-init.el +++ b/dictionary-init.el diff --git a/dictionary.el b/dictionary.el index ef820de..63342c5 100755..100644 --- a/dictionary.el +++ b/dictionary.el @@ -1,7 +1,9 @@ -;; dictionary.el -- an interface to RFC 2229 dictionary server +;;; dictionary.el --- Client for rfc2229 dictionary servers -;; Author: Torsten Hilbrich <dictionary@myrkr.in-berlin.de> +;; Author: Torsten Hilbrich <torsten.hilbrich@gmx.net> ;; Keywords: interface, dictionary +;; Version: 1.10 +;; Package-Requires: ((connection "1.10") (link "1.10")) ;; 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 @@ -18,6 +20,20 @@ ;; the Free Software Foundation, Inc., 59 Temple Place - Suite 330, ;; Boston, MA 02111-1307, USA. +;;; Commentary: + +;; dictionary allows you to interact with dictionary servers. Use M-x +;; customize-group dictioanry to modify all user settings. +;; +;; Main functions for interaction are: +;; dictionary - opens a new dictionary buffer +;; dictionary-search - search for the definition of a word +;; +;; You can find more information in the README file of the gibhub +;; repository https://github.com/myrkr/dictionary-el + +;;; Code: + (eval-when-compile (require 'cl)) @@ -40,6 +56,7 @@ (defmacro defcustom (var value doc &rest ignored) (list 'defvar var value doc)))) +(defvar dictionary-server) (defun dictionary-set-server-var (name value) (if (and (boundp 'dictionary-connection) dictionary-connection @@ -202,6 +219,16 @@ by the choice value: (if (fboundp 'defface) (progn + (defface dictionary-word-definition-face + '((((supports '(:family "DejaVu Serif"))) + (:family "DejaVu Serif")) + (((type x)) + (:font "Sans Serif")) + (t + (:font "default"))) + "The face that is used for displaying the definition of the word." + :group 'dictionary) + (defface dictionary-word-entry-face '((((type x)) (:italic t)) @@ -353,10 +380,10 @@ by the choice value: "Create a new dictonary buffer and install dictionary-mode" (interactive) (let ((buffer (or (and dictionary-use-single-buffer - (get-buffer "*Dictionary buffer*")) - (generate-new-buffer "*Dictionary buffer*"))) - (window-configuration (current-window-configuration)) - (selected-window (frame-selected-window))) + (get-buffer "*Dictionary*")) + (generate-new-buffer "*Dictionary*"))) + (window-configuration (current-window-configuration)) + (selected-window (frame-selected-window))) (switch-to-buffer-other-window buffer) (dictionary-mode) @@ -398,6 +425,8 @@ by the choice value: ;; shift-tabs normally is supported on window systems only, but ;; I do not enforce it (define-key dictionary-mode-map [(shift tab)] 'dictionary-prev-link) + (define-key dictionary-mode-map "\e\t" 'dictionary-prev-link) + (define-key dictionary-mode-map [backtab] 'dictionary-prev-link) (define-key dictionary-mode-map "n" 'dictionary-next-link) (define-key dictionary-mode-map "p" 'dictionary-prev-link) @@ -426,8 +455,9 @@ by the choice value: (connection-open dictionary-proxy-server dictionary-proxy-port) (connection-open dictionary-server dictionary-port))) - (process-kill-without-query - (connection-process dictionary-connection)) + (set-process-query-on-exit-flag + (connection-process dictionary-connection) + nil) (when dictionary-use-http-proxy (message "Proxy CONNECT to %s:%d" @@ -760,6 +790,7 @@ This function knows about the special meaning of quotes (\")" (let ((start (point))) (insert (dictionary-decode-charset reply dictionary)) (insert "\n\n") + (put-text-property start (point) 'face 'dictionary-word-definition-face) (let ((regexp "\\({+\\)\\([^ '\"][^}]*\\)\\(}+\\)")) (goto-char start) (while (< (point) (point-max)) @@ -839,7 +870,7 @@ If PATTERN is omitted, it defaults to \"[ \\f\\t\\n\\r\\v]+\"." (dictionary-display-dictionary-line "! \"The first matching dictionary\"") (let* ((reply (dictionary-read-answer)) (list (dictionary-simple-split-string reply "\n+"))) - (mapcar 'dictionary-display-dictionary-line list)) + (mapc 'dictionary-display-dictionary-line list)) (dictionary-post-buffer)) (defun dictionary-display-dictionary-line (string) @@ -928,7 +959,7 @@ If PATTERN is omitted, it defaults to \"[ \\f\\t\\n\\r\\v]+\"." (dictionary-display-strategy-line ". \"The servers default\"") (let* ((reply (dictionary-read-answer)) (list (dictionary-simple-split-string reply "\n+"))) - (mapcar 'dictionary-display-strategy-line list)) + (mapc 'dictionary-display-strategy-line list)) (dictionary-post-buffer)) (defun dictionary-display-strategy-line (string) @@ -993,18 +1024,18 @@ If PATTERN is omitted, it defaults to \"[ \\f\\t\\n\\r\\v]+\"." (insert number " matching word" (if (equal number "1") "" "s") " found\n\n") (let ((result nil)) - (mapcar (lambda (item) - (let* ((list (dictionary-split-string item)) - (dictionary (car list)) - (word (cadr list)) - (hash (assoc dictionary result))) - (if dictionary - (if hash - (setcdr hash (cons word (cdr hash))) - (setq result (cons - (cons dictionary (list word)) - result)))))) - list) + (mapc (lambda (item) + (let* ((list (dictionary-split-string item)) + (dictionary (car list)) + (word (cadr list)) + (hash (assoc dictionary result))) + (if dictionary + (if hash + (setcdr hash (cons word (cdr hash))) + (setq result (cons + (cons dictionary (list word)) + result)))))) + list) (dictionary-display-match-lines (reverse result))))) (defun dictionary-display-match-result (reply) @@ -1016,38 +1047,38 @@ If PATTERN is omitted, it defaults to \"[ \\f\\t\\n\\r\\v]+\"." (insert number " matching word" (if (equal number "1") "" "s") " found\n\n") (let ((result nil)) - (mapcar (lambda (item) - (let* ((list (dictionary-split-string item)) - (dictionary (car list)) - (word (cadr list)) - (hash (assoc dictionary result))) - (if dictionary - (if hash - (setcdr hash (cons word (cdr hash))) - (setq result (cons - (cons dictionary (list word)) - result)))))) - list) + (mapc (lambda (item) + (let* ((list (dictionary-split-string item)) + (dictionary (car list)) + (word (cadr list)) + (hash (assoc dictionary result))) + (if dictionary + (if hash + (setcdr hash (cons word (cdr hash))) + (setq result (cons + (cons dictionary (list word)) + result)))))) + list) (dictionary-display-match-lines (reverse result)))) (dictionary-post-buffer)) (defun dictionary-display-match-lines (list) "Display the match lines." - (mapcar (lambda (item) - (let ((dictionary (car item)) - (word-list (cdr item))) - (insert "Matches from " dictionary ":\n") - (mapcar (lambda (word) - (setq word (dictionary-decode-charset word dictionary)) - (insert " ") - (link-insert-link word - 'dictionary-reference-face - 'dictionary-new-search - (cons word dictionary) - "Mouse-2 to lookup word") - (insert "\n")) (reverse word-list)) - (insert "\n"))) - list)) + (mapc (lambda (item) + (let ((dictionary (car item)) + (word-list (cdr item))) + (insert "Matches from " dictionary ":\n") + (mapc (lambda (word) + (setq word (dictionary-decode-charset word dictionary)) + (insert " ") + (link-insert-link word + 'dictionary-reference-face + 'dictionary-new-search + (cons word dictionary) + "Mouse-2 to lookup word") + (insert "\n")) (reverse word-list)) + (insert "\n"))) + list)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; User callable commands @@ -1183,7 +1214,7 @@ It presents the word at point as default input and allows editing it." nil "This dictionary to lookup words for tooltips" :group 'dictionary - :type '(choice (const :tag "Default" nil) string)) + :type '(choice (const :tag "None" nil) string)) (defun dictionary-definition (word &optional dictionary) (interactive) @@ -1325,3 +1356,4 @@ It presents the word at point as default input and allows editing it." (provide 'dictionary) +;;; dictionary.el ends here diff --git a/install-package.el b/install-package.el index 5b0474e..5b0474e 100755..100644 --- a/install-package.el +++ b/install-package.el @@ -1,7 +1,8 @@ -;;; link.el -- putting clickable links into the buffer +;;; link.el --- Hypertext links in text buffers -;; Author: Torsten Hilbrich <dictionary@myrkr.in-berlin.de> +;; Author: Torsten Hilbrich <torsten.hilbrich@gmx.net> ;; Keywords: interface, hypermedia +;; Version: 1.10 ;; 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 @@ -18,7 +19,7 @@ ;; the Free Software Foundation, Inc., 59 Temple Place - Suite 330, ;; Boston, MA 02111-1307, USA. -;; Commentary: +;;; Commentary: ;; This file contains functions for using links in buffers. A link is ;; a part of the buffer marked with a special face, beeing @@ -26,7 +27,14 @@ ;; pressing return or clicking the button2. ;; Which each link a function and some data are associated. Upon -;; clicking the function is called with the data as only argument. +;; clicking the function is called with the data as only +;; argument. Both the function and the data are stored in text +;; properties. +;; +;; link-create-link - insert a new link for the text in the given range +;; link-initialize-keymap - install the keybinding for selecting links + +;;; Code: (eval-when-compile (require 'cl)) @@ -36,11 +44,11 @@ The `face' is used for displaying, the `data' are stored together with the link. Upon clicking the `function' is called with `data' as argument." (let ((properties `(face ,face - mouse-face highlight - link t - link-data ,data - help-echo ,help - link-function ,function))) + mouse-face highlight + link t + link-data ,data + help-echo ,help + link-function ,function))) (remove-text-properties start end properties) (add-text-properties start end properties))) @@ -57,10 +65,10 @@ link. Upon clicking the `function' is called with `data' as argument." (interactive) (let* ((properties (text-properties-at (point))) - (function (plist-get properties 'link-function)) - (data (plist-get properties 'link-data))) + (function (plist-get properties 'link-function)) + (data (plist-get properties 'link-data))) (if function - (funcall function data all)))) + (funcall function data all)))) (defun link-selected-all () "Called for meta clicking the link" @@ -84,25 +92,25 @@ link. Upon clicking the `function' is called with `data' as argument." (defun link-next-link () "Return the position of the next link or nil if there is none" (let* ((pos (point)) - (pos (next-single-property-change pos 'link))) + (pos (next-single-property-change pos 'link))) (if pos - (if (text-property-any pos (min (1+ pos) (point-max)) 'link t) - pos - (next-single-property-change pos 'link)) + (if (text-property-any pos (min (1+ pos) (point-max)) 'link t) + pos + (next-single-property-change pos 'link)) nil))) - + (defun link-prev-link () "Return the position of the previous link or nil if there is none" (let* ((pos (point)) - (pos (previous-single-property-change pos 'link))) + (pos (previous-single-property-change pos 'link))) (if pos - (if (text-property-any pos (1+ pos) 'link t) - pos - (let ((val (previous-single-property-change pos 'link))) - (if val - val - (text-property-any (point-min) (1+ (point-min)) 'link t)))) + (if (text-property-any pos (1+ pos) 'link t) + pos + (let ((val (previous-single-property-change pos 'link))) + (if val + val + (text-property-any (point-min) (1+ (point-min)) 'link t)))) nil))) (defun link-initialize-keymap (keymap) @@ -110,11 +118,12 @@ link. Upon clicking the `function' is called with `data' as argument." (if (and (boundp 'running-xemacs) running-xemacs) (progn - (define-key keymap [button2] 'link-mouse-click) - (define-key keymap [(meta button2)] 'link-mouse-click-all)) + (define-key keymap [button2] 'link-mouse-click) + (define-key keymap [(meta button2)] 'link-mouse-click-all)) (define-key keymap [mouse-2] 'link-mouse-click) (define-key keymap [M-mouse-2] 'link-mouse-click-all)) (define-key keymap "\r" 'link-selected) (define-key keymap "\M-\r" 'link-selected-all)) (provide 'link) +;;; link.el ends here |