2020-11-19 21:39:10 +01:00
|
|
|
;;; dictionary.el --- Client for rfc2229 dictionary servers -*- lexical-binding:t -*-
|
2020-10-05 06:50:25 +02:00
|
|
|
|
2023-01-01 05:31:12 -05:00
|
|
|
;; Copyright (C) 2021-2023 Free Software Foundation, Inc.
|
2021-02-07 16:02:30 +01:00
|
|
|
|
2020-10-05 06:50:25 +02:00
|
|
|
;; Author: Torsten Hilbrich <torsten.hilbrich@gmx.net>
|
|
|
|
;; Keywords: interface, dictionary
|
|
|
|
|
2021-02-07 16:02:30 +01:00
|
|
|
;; This file is part of GNU Emacs.
|
|
|
|
|
|
|
|
;; GNU Emacs is free software: you can redistribute it and/or modify
|
2020-10-05 06:50:25 +02:00
|
|
|
;; it under the terms of the GNU General Public License as published by
|
2021-02-07 16:02:30 +01:00
|
|
|
;; the Free Software Foundation, either version 3 of the License, or
|
|
|
|
;; (at your option) any later version.
|
2020-10-05 06:50:25 +02:00
|
|
|
|
2021-02-07 16:02:30 +01:00
|
|
|
;; GNU Emacs is distributed in the hope that it will be useful,
|
2020-10-05 06:50:25 +02:00
|
|
|
;; 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
|
2021-02-07 16:02:30 +01:00
|
|
|
;; along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
|
2020-10-05 06:50:25 +02:00
|
|
|
|
|
|
|
;;; Commentary:
|
|
|
|
|
|
|
|
;; dictionary allows you to interact with dictionary servers.
|
2023-08-12 16:40:10 +02:00
|
|
|
;;
|
|
|
|
;; Use `M-x customize-group RET dictionary RET' to modify user settings.
|
2020-10-05 06:50:25 +02:00
|
|
|
;;
|
2021-09-14 07:55:56 +02:00
|
|
|
;; Main commands for interaction are:
|
2023-08-12 16:40:10 +02:00
|
|
|
;; `M-x dictionary' - open a new dictionary buffer
|
|
|
|
;; `M-x dictionary-search' - search for the definition of a word
|
2020-10-05 06:50:25 +02:00
|
|
|
;;
|
|
|
|
;; You can find more information in the README file of the GitHub
|
|
|
|
;; repository https://github.com/myrkr/dictionary-el
|
|
|
|
|
|
|
|
;;; Code:
|
|
|
|
|
|
|
|
(require 'custom)
|
2020-10-05 06:56:59 +02:00
|
|
|
(require 'dictionary-connection)
|
2020-10-09 05:00:02 +02:00
|
|
|
(require 'button)
|
2023-05-15 21:04:21 +03:00
|
|
|
(require 'help-mode)
|
|
|
|
(require 'external-completion)
|
2020-10-05 06:50:25 +02:00
|
|
|
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
;; Stuff for customizing.
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
|
2020-11-19 08:23:07 +01:00
|
|
|
(defvar dictionary-current-server)
|
2020-10-05 06:50:25 +02:00
|
|
|
(defun dictionary-set-server-var (name value)
|
A number of docstring fixes
* lisp/net/dictionary.el (dictionary-set-server-var, dictionary-mode,
dictionary, dictionary-new-buffer, dictionary-reply-code,
dictionary-reply, dictionary-reply-list, dictionary-open-server,
dictionary-check-connection, dictionary-mode-p, dictionary-close,
dictionary-read-reply, dictionary-split-string,
dictionary-read-reply-and-split, dictionary-read-answer,
dictionary-check-reply, dictionary-coding-system,
dictionary-decode-charset, dictionary-encode-charset,
dictionary-check-initial-reply, dictionary-store-state,
dictionary-restore-state, dictionary-new-search,
dictionary-new-search-internal, dictionary-do-search,
dictionary-pre-buffer, dictionary-post-buffer,
dictionary-display-search-result, dictionary-display-word-entry,
dictionary-display-word-definition, dictionary-mark-reference,
dictionary-select-dictionary, dictionary-display-dictionarys,
dictionary-display-dictionary-line, dictionary-set-dictionary,
dictionary-special-dictionary, dictionary-display-more-info,
dictionary-select-strategy, dictionary-do-select-strategy,
dictionary-display-strategies, dictionary-display-strategy-line,
dictionary-set-strategy, dictionary-new-matching,
dictionary-do-matching, dictionary-display-only-match-result,
dictionary-display-match-result, dictionary-display-match-result,
dictionary-display-match-lines, dictionary-search,
dictionary-previous, dictionary-help, dictionary-match-words,
dictionary-mouse-popup-matching-words,
dictionary-popup-matching-words, dictionary-tooltip-mode,
dictionary-tooltip-mouse-event): Fix docstring
The following kind of changes were made:
- finish first line with a full stop (.)
- mention parameter in upper-case whenever possible (considering the
length constraints)
2020-12-14 10:55:35 +01:00
|
|
|
"Customize helper for setting variable NAME to VALUE.
|
|
|
|
The helper is used by customize to check for an active connection
|
Various doc fixes in dictionary.el
* lisp/net/dictionary.el (dictionary-set-server-var)
(dictionary-server, dictionary-port)
(dictionary-default-dictionary)
(dictionary-default-popup-strategy, dictionary-proxy-server)
(dictionary-proxy-port, dictionary-description-open-delimiter)
(dictionary-description-close-delimiter)
(dictionary-window-configuration, dictionary-selected-window)
(dictionary-position-stack, dictionary-data-stack)
(dictionary-positions, dictionary-current-data)
(dictionary-connection, dictionary-instances)
(dictionary-color-support, dictionary-word-history)
(dictionary-mode, dictionary, dictionary-check-connection)
(dictionary-mode-p, dictionary-send-command)
(dictionary-read-reply-and-split, dictionary-check-reply)
(dictionary-check-initial-reply, dictionary-store-state)
(dictionary-store-positions, dictionary-new-search)
(dictionary-new-search-internal, dictionary-do-search)
(dictionary-display-search-result)
(dictionary-display-word-definition)
(dictionary-special-dictionary, dictionary-set-strategy)
(dictionary-tooltip-dictionary, dictionary-switch-tooltip-mode)
(dictionary-tooltip-mode, global-dictionary-tooltip-mode): Doc fixes
to adhere to our conventions.
2021-02-07 15:53:46 +01:00
|
|
|
when setting a variable. The user has then the choice to close
|
A number of docstring fixes
* lisp/net/dictionary.el (dictionary-set-server-var, dictionary-mode,
dictionary, dictionary-new-buffer, dictionary-reply-code,
dictionary-reply, dictionary-reply-list, dictionary-open-server,
dictionary-check-connection, dictionary-mode-p, dictionary-close,
dictionary-read-reply, dictionary-split-string,
dictionary-read-reply-and-split, dictionary-read-answer,
dictionary-check-reply, dictionary-coding-system,
dictionary-decode-charset, dictionary-encode-charset,
dictionary-check-initial-reply, dictionary-store-state,
dictionary-restore-state, dictionary-new-search,
dictionary-new-search-internal, dictionary-do-search,
dictionary-pre-buffer, dictionary-post-buffer,
dictionary-display-search-result, dictionary-display-word-entry,
dictionary-display-word-definition, dictionary-mark-reference,
dictionary-select-dictionary, dictionary-display-dictionarys,
dictionary-display-dictionary-line, dictionary-set-dictionary,
dictionary-special-dictionary, dictionary-display-more-info,
dictionary-select-strategy, dictionary-do-select-strategy,
dictionary-display-strategies, dictionary-display-strategy-line,
dictionary-set-strategy, dictionary-new-matching,
dictionary-do-matching, dictionary-display-only-match-result,
dictionary-display-match-result, dictionary-display-match-result,
dictionary-display-match-lines, dictionary-search,
dictionary-previous, dictionary-help, dictionary-match-words,
dictionary-mouse-popup-matching-words,
dictionary-popup-matching-words, dictionary-tooltip-mode,
dictionary-tooltip-mouse-event): Fix docstring
The following kind of changes were made:
- finish first line with a full stop (.)
- mention parameter in upper-case whenever possible (considering the
length constraints)
2020-12-14 10:55:35 +01:00
|
|
|
the existing connection."
|
2020-10-05 06:50:25 +02:00
|
|
|
(if (and (boundp 'dictionary-connection)
|
|
|
|
dictionary-connection
|
2020-10-05 06:56:59 +02:00
|
|
|
(eq (dictionary-connection-status dictionary-connection) 'up)
|
2020-10-05 06:50:25 +02:00
|
|
|
(y-or-n-p
|
2020-11-19 08:23:07 +01:00
|
|
|
(concat "Close existing connection to " dictionary-current-server "? ")))
|
2020-10-05 06:56:59 +02:00
|
|
|
(dictionary-connection-close dictionary-connection))
|
2020-10-05 06:50:25 +02:00
|
|
|
(set-default name value))
|
|
|
|
|
|
|
|
(defgroup dictionary nil
|
2021-09-14 07:55:56 +02:00
|
|
|
"Client for accessing the dictd server based dictionaries."
|
2022-09-30 15:12:21 +02:00
|
|
|
:group 'applications)
|
2020-10-05 06:50:25 +02:00
|
|
|
|
|
|
|
(defgroup dictionary-proxy nil
|
2021-09-14 07:55:56 +02:00
|
|
|
"Proxy configuration options for the dictionary client."
|
2020-10-05 06:50:25 +02:00
|
|
|
:group 'dictionary)
|
|
|
|
|
|
|
|
(defcustom dictionary-server
|
2020-11-19 08:23:07 +01:00
|
|
|
nil
|
|
|
|
"This server is contacted for searching the dictionary.
|
|
|
|
|
|
|
|
You can specify here:
|
|
|
|
|
|
|
|
- Automatic: First try localhost, then dict.org after confirmation
|
|
|
|
- localhost: Only use localhost
|
|
|
|
- dict.org: Only use dict.org
|
Various doc fixes in dictionary.el
* lisp/net/dictionary.el (dictionary-set-server-var)
(dictionary-server, dictionary-port)
(dictionary-default-dictionary)
(dictionary-default-popup-strategy, dictionary-proxy-server)
(dictionary-proxy-port, dictionary-description-open-delimiter)
(dictionary-description-close-delimiter)
(dictionary-window-configuration, dictionary-selected-window)
(dictionary-position-stack, dictionary-data-stack)
(dictionary-positions, dictionary-current-data)
(dictionary-connection, dictionary-instances)
(dictionary-color-support, dictionary-word-history)
(dictionary-mode, dictionary, dictionary-check-connection)
(dictionary-mode-p, dictionary-send-command)
(dictionary-read-reply-and-split, dictionary-check-reply)
(dictionary-check-initial-reply, dictionary-store-state)
(dictionary-store-positions, dictionary-new-search)
(dictionary-new-search-internal, dictionary-do-search)
(dictionary-display-search-result)
(dictionary-display-word-definition)
(dictionary-special-dictionary, dictionary-set-strategy)
(dictionary-tooltip-dictionary, dictionary-switch-tooltip-mode)
(dictionary-tooltip-mode, global-dictionary-tooltip-mode): Doc fixes
to adhere to our conventions.
2021-02-07 15:53:46 +01:00
|
|
|
- User-defined: You can specify your own server here"
|
2020-10-05 06:50:25 +02:00
|
|
|
:group 'dictionary
|
2021-03-08 10:11:22 -05:00
|
|
|
:set #'dictionary-set-server-var
|
2020-11-19 08:23:07 +01:00
|
|
|
:type '(choice (const :tag "Automatic" nil)
|
|
|
|
(const :tag "localhost" "localhost")
|
|
|
|
(const :tag "dict.org" "dict.org")
|
|
|
|
(string :tag "User-defined"))
|
2020-10-08 19:30:12 +02:00
|
|
|
:version "28.1")
|
2020-10-05 06:50:25 +02:00
|
|
|
|
|
|
|
(defcustom dictionary-port
|
|
|
|
2628
|
|
|
|
"The port of the dictionary server.
|
2021-09-03 11:13:53 +02:00
|
|
|
This port is probably always 2628 so there should be no need to modify it."
|
2020-10-05 06:50:25 +02:00
|
|
|
:group 'dictionary
|
2021-03-08 10:11:22 -05:00
|
|
|
:set #'dictionary-set-server-var
|
Make some defcustom types more restrictive
* lisp/abbrev.el (abbrev-suggest-hint-threshold):
* lisp/bookmark.el (bookmark-bmenu-file-column)
(bookmark-menu-length):
* lisp/buff-menu.el (Buffer-menu-size-width)
(Buffer-menu-mode-width):
* lisp/calendar/calendar.el (calendar-week-start-day)
(calendar-intermonth-spacing, calendar-column-width)
(calendar-day-digit-width):
* lisp/calc/calc.el (calc-undo-length):
* lisp/calendar/timeclock.el (timeclock-workday):
* lisp/comint.el (comint-buffer-maximum-size)
(comint-input-ring-size):
* lisp/doc-view.el (doc-view-resolution, doc-view-image-width):
* lisp/emacs-lisp/bytecomp.el (byte-compile-docstring-max-column):
* lisp/emacs-lisp/comp.el (native-comp-debug)
(native-comp-verbose, native-comp-async-jobs-number):
* lisp/emacs-lisp/package.el (package-name-column-width)
(package-version-column-width, package-status-column-width)
(package-archive-column-width):
* lisp/eshell/esh-mode.el (eshell-buffer-maximum-lines):
* lisp/frame.el (blink-cursor-blinks):
* lisp/info.el (Info-breadcrumbs-depth):
* lisp/jit-lock.el (jit-lock-chunk-size):
* lisp/kmacro.el (kmacro-ring-max):
* lisp/menu-bar.el (yank-menu-length, yank-menu-max-items):
* lisp/midnight.el (clean-buffer-list-delay-general)
(clean-buffer-list-delay-special):
* lisp/net/dictionary.el (dictionary-port)
(dictionary-proxy-port):
* lisp/net/ldap.el (ldap-default-port):
* lisp/net/pop3.el (pop3-port, pop3-stream-length):
* lisp/net/rcirc.el (rcirc-default-port):
* lisp/net/sieve-manage.el (sieve-manage-default-port):
* lisp/play/spook.el (spook-phrase-default-count):
* lisp/play/tetris.el (tetris-buffer-width)
(tetris-buffer-height, tetris-width, tetris-height)
(tetris-top-left-x, tetris-top-left-y):
* lisp/profiler.el (profiler-sampling-interval):
* lisp/progmodes/sql.el (sql-port):
* lisp/recentf.el (recentf-max-menu-items):
* lisp/strokes.el (strokes-grid-resolution):
* lisp/tab-bar.el (tab-bar-tab-name-truncated-max):
* lisp/term/xterm.el (xterm-max-cut-length):
* lisp/time.el (display-time-interval, world-clock-timer-second):
* lisp/url/url-cache.el (url-cache-expire-time):
* lisp/url/url-cookie.el (url-cookie-save-interval):
* lisp/url/url-history.el (url-history-save-interval):
* lisp/url/url-queue.el (url-queue-parallel-processes)
(url-queue-timeout):
* lisp/url/url-vars.el (url-max-password-attempts)
(url-max-redirections):
* lisp/vc/emerge.el (emerge-min-visible-lines):
* lisp/vc/vc.el (vc-log-show-limit):
* lisp/window.el (window-min-height, window-min-width):
* lisp/winner.el (winner-ring-size): Use :type natnum.
* lisp/savehist.el (savehist-file-modes): Fix setting to nil value and
use :type natnum.
2022-07-05 16:26:45 +02:00
|
|
|
:type 'natnum
|
2020-10-08 19:30:12 +02:00
|
|
|
:version "28.1")
|
2020-10-05 06:50:25 +02:00
|
|
|
|
|
|
|
(defcustom dictionary-identification
|
|
|
|
"dictionary.el emacs lisp dictionary client"
|
|
|
|
"This is the identification string that will be sent to the server."
|
|
|
|
:group 'dictionary
|
2020-10-08 19:30:12 +02:00
|
|
|
:type 'string
|
|
|
|
:version "28.1")
|
2020-10-05 06:50:25 +02:00
|
|
|
|
|
|
|
(defcustom dictionary-default-dictionary
|
|
|
|
"*"
|
|
|
|
"The dictionary which is used for searching definitions and matching.
|
Various doc fixes in dictionary.el
* lisp/net/dictionary.el (dictionary-set-server-var)
(dictionary-server, dictionary-port)
(dictionary-default-dictionary)
(dictionary-default-popup-strategy, dictionary-proxy-server)
(dictionary-proxy-port, dictionary-description-open-delimiter)
(dictionary-description-close-delimiter)
(dictionary-window-configuration, dictionary-selected-window)
(dictionary-position-stack, dictionary-data-stack)
(dictionary-positions, dictionary-current-data)
(dictionary-connection, dictionary-instances)
(dictionary-color-support, dictionary-word-history)
(dictionary-mode, dictionary, dictionary-check-connection)
(dictionary-mode-p, dictionary-send-command)
(dictionary-read-reply-and-split, dictionary-check-reply)
(dictionary-check-initial-reply, dictionary-store-state)
(dictionary-store-positions, dictionary-new-search)
(dictionary-new-search-internal, dictionary-do-search)
(dictionary-display-search-result)
(dictionary-display-word-definition)
(dictionary-special-dictionary, dictionary-set-strategy)
(dictionary-tooltip-dictionary, dictionary-switch-tooltip-mode)
(dictionary-tooltip-mode, global-dictionary-tooltip-mode): Doc fixes
to adhere to our conventions.
2021-02-07 15:53:46 +01:00
|
|
|
* and ! have a special meaning, * search all dictionaries, ! search until
|
|
|
|
one dictionary yields matches."
|
2020-10-05 06:50:25 +02:00
|
|
|
:group 'dictionary
|
2020-10-08 19:30:12 +02:00
|
|
|
:type 'string
|
|
|
|
:version "28.1")
|
2020-10-05 06:50:25 +02:00
|
|
|
|
|
|
|
(defcustom dictionary-default-strategy
|
|
|
|
"."
|
|
|
|
"The default strategy for listing matching words."
|
|
|
|
:group 'dictionary
|
2020-10-08 19:30:12 +02:00
|
|
|
:type 'string
|
|
|
|
:version "28.1")
|
2020-10-05 06:50:25 +02:00
|
|
|
|
|
|
|
(defcustom dictionary-default-popup-strategy
|
|
|
|
"exact"
|
|
|
|
"The default strategy for listing matching words within a popup window.
|
|
|
|
|
2022-07-14 17:33:46 +02:00
|
|
|
The following algorithms (defined by the dictd server) are supported
|
2020-10-05 06:50:25 +02:00
|
|
|
by the choice value:
|
|
|
|
|
|
|
|
- Exact match
|
|
|
|
|
|
|
|
The found word exactly matches the searched word.
|
|
|
|
|
Fix typos
* doc/lispref/display.texi (Size of Displayed Text):
* doc/lispref/windows.texi (Buffer Display Action Functions):
* etc/NEWS:
* etc/ORG-NEWS (Org-Attach has been refactored and extended):
* lisp/battery.el (display-battery-mode, battery--upower-subsribe):
* lisp/calendar/parse-time.el:
* lisp/dired-x.el:
* lisp/emacs-lisp/chart.el (chart-sequece, chart-bar-quickie):
* lisp/emacs-lisp/eldoc.el (eldoc-echo-area-use-multiline-p)
(eldoc-documentation-strategy):
* lisp/emacs-lisp/pcase.el (pcase--split-pred, pcase--u1):
* lisp/gnus/gnus-search.el (gnus-search-expandable-keys)
(gnus-search-parse-query, gnus-search-query-return-string)
(gnus-search-imap, gnus-search-imap-search-command)
(gnus-search-transform-expression):
* lisp/gnus/nnselect.el:
* lisp/isearch.el (isearch-lazy-count-format):
* lisp/mh-e/mh-show.el (mh-show-msg):
* lisp/net/dictionary-connection.el (dictionary-connection-open):
* lisp/net/dictionary.el (dictionary-default-popup-strategy)
(dictionary, dictionary-split-string, dictionary-do-select-dictionary)
(dictionary-display-dictionarys, dictionary-search)
(dictionary-tooltip-mode):
* lisp/net/eudcb-macos-contacts.el (eudc-macos-contacts-set-server):
* lisp/net/mailcap.el (mailcap-mime-data):
* lisp/net/tramp-smb.el (tramp-smb-maybe-open-connection):
* lisp/nxml/nxml-mode.el (nxml-mode):
* lisp/progmodes/cc-engine.el:
* lisp/progmodes/cperl-mode.el (cperl-mode)
(cperl-fontify-syntaxically):
* lisp/progmodes/flymake.el (flymake-diagnostic-functions):
* lisp/progmodes/verilog-mode.el (verilog--supressed-warnings)
(verilog-preprocess):
* lisp/simple.el (self-insert-uses-region-functions):
* lisp/textmodes/bibtex.el (bibtex-copy-summary-as-kill):
* lisp/textmodes/texnfo-upd.el (texinfo-insert-master-menu-list):
* src/dispnew.c:
* src/font.c (Ffont_get):
* src/indent.c (compute_motion):
* src/process.c (init_process_emacs):
* src/w32fns.c (deliver_wm_chars):
* test/lisp/jsonrpc-tests.el (deferred-action-complex-tests):
Fix typos in documentation, comments, and internal identifiers.
2021-02-18 16:41:36 +01:00
|
|
|
- Similar sounding
|
2020-10-05 06:50:25 +02:00
|
|
|
|
Fix typos
* doc/lispref/display.texi (Size of Displayed Text):
* doc/lispref/windows.texi (Buffer Display Action Functions):
* etc/NEWS:
* etc/ORG-NEWS (Org-Attach has been refactored and extended):
* lisp/battery.el (display-battery-mode, battery--upower-subsribe):
* lisp/calendar/parse-time.el:
* lisp/dired-x.el:
* lisp/emacs-lisp/chart.el (chart-sequece, chart-bar-quickie):
* lisp/emacs-lisp/eldoc.el (eldoc-echo-area-use-multiline-p)
(eldoc-documentation-strategy):
* lisp/emacs-lisp/pcase.el (pcase--split-pred, pcase--u1):
* lisp/gnus/gnus-search.el (gnus-search-expandable-keys)
(gnus-search-parse-query, gnus-search-query-return-string)
(gnus-search-imap, gnus-search-imap-search-command)
(gnus-search-transform-expression):
* lisp/gnus/nnselect.el:
* lisp/isearch.el (isearch-lazy-count-format):
* lisp/mh-e/mh-show.el (mh-show-msg):
* lisp/net/dictionary-connection.el (dictionary-connection-open):
* lisp/net/dictionary.el (dictionary-default-popup-strategy)
(dictionary, dictionary-split-string, dictionary-do-select-dictionary)
(dictionary-display-dictionarys, dictionary-search)
(dictionary-tooltip-mode):
* lisp/net/eudcb-macos-contacts.el (eudc-macos-contacts-set-server):
* lisp/net/mailcap.el (mailcap-mime-data):
* lisp/net/tramp-smb.el (tramp-smb-maybe-open-connection):
* lisp/nxml/nxml-mode.el (nxml-mode):
* lisp/progmodes/cc-engine.el:
* lisp/progmodes/cperl-mode.el (cperl-mode)
(cperl-fontify-syntaxically):
* lisp/progmodes/flymake.el (flymake-diagnostic-functions):
* lisp/progmodes/verilog-mode.el (verilog--supressed-warnings)
(verilog-preprocess):
* lisp/simple.el (self-insert-uses-region-functions):
* lisp/textmodes/bibtex.el (bibtex-copy-summary-as-kill):
* lisp/textmodes/texnfo-upd.el (texinfo-insert-master-menu-list):
* src/dispnew.c:
* src/font.c (Ffont_get):
* src/indent.c (compute_motion):
* src/process.c (init_process_emacs):
* src/w32fns.c (deliver_wm_chars):
* test/lisp/jsonrpc-tests.el (deferred-action-complex-tests):
Fix typos in documentation, comments, and internal identifiers.
2021-02-18 16:41:36 +01:00
|
|
|
The found word sounds similar to the searched word. For this match type
|
2020-10-05 06:50:25 +02:00
|
|
|
the soundex algorithm defined by Donald E. Knuth is used. It will only
|
2022-07-14 17:33:46 +02:00
|
|
|
work with English words and the algorithm is not very reliable (i.e.,
|
2020-10-05 06:50:25 +02:00
|
|
|
the soundex algorithm is quite simple).
|
|
|
|
|
|
|
|
- Levenshtein distance one
|
|
|
|
|
|
|
|
The Levenshtein distance is defined as the number of insertions, deletions,
|
|
|
|
or replacements needed to get the searched word. This algorithm searches
|
|
|
|
for word where spelling mistakes are allowed. Levenshtein distance one
|
|
|
|
means there is either a deleted character, an inserted character, or a
|
|
|
|
modified one.
|
|
|
|
|
|
|
|
- User choice
|
|
|
|
|
|
|
|
Here you can enter any matching algorithm supported by your
|
Various doc fixes in dictionary.el
* lisp/net/dictionary.el (dictionary-set-server-var)
(dictionary-server, dictionary-port)
(dictionary-default-dictionary)
(dictionary-default-popup-strategy, dictionary-proxy-server)
(dictionary-proxy-port, dictionary-description-open-delimiter)
(dictionary-description-close-delimiter)
(dictionary-window-configuration, dictionary-selected-window)
(dictionary-position-stack, dictionary-data-stack)
(dictionary-positions, dictionary-current-data)
(dictionary-connection, dictionary-instances)
(dictionary-color-support, dictionary-word-history)
(dictionary-mode, dictionary, dictionary-check-connection)
(dictionary-mode-p, dictionary-send-command)
(dictionary-read-reply-and-split, dictionary-check-reply)
(dictionary-check-initial-reply, dictionary-store-state)
(dictionary-store-positions, dictionary-new-search)
(dictionary-new-search-internal, dictionary-do-search)
(dictionary-display-search-result)
(dictionary-display-word-definition)
(dictionary-special-dictionary, dictionary-set-strategy)
(dictionary-tooltip-dictionary, dictionary-switch-tooltip-mode)
(dictionary-tooltip-mode, global-dictionary-tooltip-mode): Doc fixes
to adhere to our conventions.
2021-02-07 15:53:46 +01:00
|
|
|
dictionary server."
|
2020-10-05 06:50:25 +02:00
|
|
|
:group 'dictionary
|
|
|
|
:type '(choice (const :tag "Exact match" "exact")
|
Fix typos
* doc/lispref/display.texi (Size of Displayed Text):
* doc/lispref/windows.texi (Buffer Display Action Functions):
* etc/NEWS:
* etc/ORG-NEWS (Org-Attach has been refactored and extended):
* lisp/battery.el (display-battery-mode, battery--upower-subsribe):
* lisp/calendar/parse-time.el:
* lisp/dired-x.el:
* lisp/emacs-lisp/chart.el (chart-sequece, chart-bar-quickie):
* lisp/emacs-lisp/eldoc.el (eldoc-echo-area-use-multiline-p)
(eldoc-documentation-strategy):
* lisp/emacs-lisp/pcase.el (pcase--split-pred, pcase--u1):
* lisp/gnus/gnus-search.el (gnus-search-expandable-keys)
(gnus-search-parse-query, gnus-search-query-return-string)
(gnus-search-imap, gnus-search-imap-search-command)
(gnus-search-transform-expression):
* lisp/gnus/nnselect.el:
* lisp/isearch.el (isearch-lazy-count-format):
* lisp/mh-e/mh-show.el (mh-show-msg):
* lisp/net/dictionary-connection.el (dictionary-connection-open):
* lisp/net/dictionary.el (dictionary-default-popup-strategy)
(dictionary, dictionary-split-string, dictionary-do-select-dictionary)
(dictionary-display-dictionarys, dictionary-search)
(dictionary-tooltip-mode):
* lisp/net/eudcb-macos-contacts.el (eudc-macos-contacts-set-server):
* lisp/net/mailcap.el (mailcap-mime-data):
* lisp/net/tramp-smb.el (tramp-smb-maybe-open-connection):
* lisp/nxml/nxml-mode.el (nxml-mode):
* lisp/progmodes/cc-engine.el:
* lisp/progmodes/cperl-mode.el (cperl-mode)
(cperl-fontify-syntaxically):
* lisp/progmodes/flymake.el (flymake-diagnostic-functions):
* lisp/progmodes/verilog-mode.el (verilog--supressed-warnings)
(verilog-preprocess):
* lisp/simple.el (self-insert-uses-region-functions):
* lisp/textmodes/bibtex.el (bibtex-copy-summary-as-kill):
* lisp/textmodes/texnfo-upd.el (texinfo-insert-master-menu-list):
* src/dispnew.c:
* src/font.c (Ffont_get):
* src/indent.c (compute_motion):
* src/process.c (init_process_emacs):
* src/w32fns.c (deliver_wm_chars):
* test/lisp/jsonrpc-tests.el (deferred-action-complex-tests):
Fix typos in documentation, comments, and internal identifiers.
2021-02-18 16:41:36 +01:00
|
|
|
(const :tag "Similar sounding" "soundex")
|
2020-10-05 06:50:25 +02:00
|
|
|
(const :tag "Levenshtein distance one" "lev")
|
2020-10-08 19:30:12 +02:00
|
|
|
(string :tag "User choice"))
|
|
|
|
:version "28.1")
|
2020-10-05 06:50:25 +02:00
|
|
|
|
|
|
|
(defcustom dictionary-create-buttons
|
|
|
|
t
|
|
|
|
"Create some clickable buttons on top of the window if non-nil."
|
|
|
|
:group 'dictionary
|
2020-10-08 19:30:12 +02:00
|
|
|
:type 'boolean
|
|
|
|
:version "28.1")
|
2020-10-05 06:50:25 +02:00
|
|
|
|
2021-02-09 20:29:54 +02:00
|
|
|
(defcustom dictionary-link-dictionary
|
|
|
|
"*"
|
|
|
|
"The dictionary which is used in links.
|
|
|
|
* means to create links that search all dictionaries,
|
|
|
|
nil means to create links that search only in the same dictionary
|
|
|
|
where the current word was found."
|
|
|
|
:group 'dictionary
|
|
|
|
:type '(choice (const :tag "Link to all dictionaries" "*")
|
|
|
|
(const :tag "Link only to the same dictionary" nil)
|
|
|
|
(string :tag "User choice"))
|
|
|
|
:version "28.1")
|
|
|
|
|
2020-10-05 06:50:25 +02:00
|
|
|
(defcustom dictionary-mode-hook
|
|
|
|
nil
|
|
|
|
"Hook run in dictionary mode buffers."
|
|
|
|
:group 'dictionary
|
2020-10-08 19:30:12 +02:00
|
|
|
:type 'hook
|
|
|
|
:version "28.1")
|
2020-10-05 06:50:25 +02:00
|
|
|
|
2021-02-09 20:29:54 +02:00
|
|
|
(defcustom dictionary-post-buffer-hook
|
|
|
|
nil
|
|
|
|
"Hook run at the end of every update of the dictionary buffer."
|
|
|
|
:group 'dictionary
|
|
|
|
:type 'hook
|
|
|
|
:version "28.1")
|
|
|
|
|
2020-10-05 06:50:25 +02:00
|
|
|
(defcustom dictionary-use-http-proxy
|
|
|
|
nil
|
|
|
|
"Connects via a HTTP proxy using the CONNECT command when not nil."
|
|
|
|
:group 'dictionary-proxy
|
2021-03-08 10:11:22 -05:00
|
|
|
:set #'dictionary-set-server-var
|
2020-10-08 19:30:12 +02:00
|
|
|
:type 'boolean
|
|
|
|
:version "28.1")
|
2020-10-05 06:50:25 +02:00
|
|
|
|
|
|
|
(defcustom dictionary-proxy-server
|
|
|
|
"proxy"
|
Various doc fixes in dictionary.el
* lisp/net/dictionary.el (dictionary-set-server-var)
(dictionary-server, dictionary-port)
(dictionary-default-dictionary)
(dictionary-default-popup-strategy, dictionary-proxy-server)
(dictionary-proxy-port, dictionary-description-open-delimiter)
(dictionary-description-close-delimiter)
(dictionary-window-configuration, dictionary-selected-window)
(dictionary-position-stack, dictionary-data-stack)
(dictionary-positions, dictionary-current-data)
(dictionary-connection, dictionary-instances)
(dictionary-color-support, dictionary-word-history)
(dictionary-mode, dictionary, dictionary-check-connection)
(dictionary-mode-p, dictionary-send-command)
(dictionary-read-reply-and-split, dictionary-check-reply)
(dictionary-check-initial-reply, dictionary-store-state)
(dictionary-store-positions, dictionary-new-search)
(dictionary-new-search-internal, dictionary-do-search)
(dictionary-display-search-result)
(dictionary-display-word-definition)
(dictionary-special-dictionary, dictionary-set-strategy)
(dictionary-tooltip-dictionary, dictionary-switch-tooltip-mode)
(dictionary-tooltip-mode, global-dictionary-tooltip-mode): Doc fixes
to adhere to our conventions.
2021-02-07 15:53:46 +01:00
|
|
|
"The name of the HTTP proxy to use when `dictionary-use-http-proxy' is set."
|
2020-10-05 06:50:25 +02:00
|
|
|
:group 'dictionary-proxy
|
2021-03-08 10:11:22 -05:00
|
|
|
:set #'dictionary-set-server-var
|
2020-10-08 19:30:12 +02:00
|
|
|
:type 'string
|
|
|
|
:version "28.1")
|
2020-10-05 06:50:25 +02:00
|
|
|
|
|
|
|
(defcustom dictionary-proxy-port
|
|
|
|
3128
|
Various doc fixes in dictionary.el
* lisp/net/dictionary.el (dictionary-set-server-var)
(dictionary-server, dictionary-port)
(dictionary-default-dictionary)
(dictionary-default-popup-strategy, dictionary-proxy-server)
(dictionary-proxy-port, dictionary-description-open-delimiter)
(dictionary-description-close-delimiter)
(dictionary-window-configuration, dictionary-selected-window)
(dictionary-position-stack, dictionary-data-stack)
(dictionary-positions, dictionary-current-data)
(dictionary-connection, dictionary-instances)
(dictionary-color-support, dictionary-word-history)
(dictionary-mode, dictionary, dictionary-check-connection)
(dictionary-mode-p, dictionary-send-command)
(dictionary-read-reply-and-split, dictionary-check-reply)
(dictionary-check-initial-reply, dictionary-store-state)
(dictionary-store-positions, dictionary-new-search)
(dictionary-new-search-internal, dictionary-do-search)
(dictionary-display-search-result)
(dictionary-display-word-definition)
(dictionary-special-dictionary, dictionary-set-strategy)
(dictionary-tooltip-dictionary, dictionary-switch-tooltip-mode)
(dictionary-tooltip-mode, global-dictionary-tooltip-mode): Doc fixes
to adhere to our conventions.
2021-02-07 15:53:46 +01:00
|
|
|
"The port of the proxy server, used only when `dictionary-use-http-proxy' is set."
|
2020-10-05 06:50:25 +02:00
|
|
|
:group 'dictionary-proxy
|
2021-03-08 10:11:22 -05:00
|
|
|
:set #'dictionary-set-server-var
|
Make some defcustom types more restrictive
* lisp/abbrev.el (abbrev-suggest-hint-threshold):
* lisp/bookmark.el (bookmark-bmenu-file-column)
(bookmark-menu-length):
* lisp/buff-menu.el (Buffer-menu-size-width)
(Buffer-menu-mode-width):
* lisp/calendar/calendar.el (calendar-week-start-day)
(calendar-intermonth-spacing, calendar-column-width)
(calendar-day-digit-width):
* lisp/calc/calc.el (calc-undo-length):
* lisp/calendar/timeclock.el (timeclock-workday):
* lisp/comint.el (comint-buffer-maximum-size)
(comint-input-ring-size):
* lisp/doc-view.el (doc-view-resolution, doc-view-image-width):
* lisp/emacs-lisp/bytecomp.el (byte-compile-docstring-max-column):
* lisp/emacs-lisp/comp.el (native-comp-debug)
(native-comp-verbose, native-comp-async-jobs-number):
* lisp/emacs-lisp/package.el (package-name-column-width)
(package-version-column-width, package-status-column-width)
(package-archive-column-width):
* lisp/eshell/esh-mode.el (eshell-buffer-maximum-lines):
* lisp/frame.el (blink-cursor-blinks):
* lisp/info.el (Info-breadcrumbs-depth):
* lisp/jit-lock.el (jit-lock-chunk-size):
* lisp/kmacro.el (kmacro-ring-max):
* lisp/menu-bar.el (yank-menu-length, yank-menu-max-items):
* lisp/midnight.el (clean-buffer-list-delay-general)
(clean-buffer-list-delay-special):
* lisp/net/dictionary.el (dictionary-port)
(dictionary-proxy-port):
* lisp/net/ldap.el (ldap-default-port):
* lisp/net/pop3.el (pop3-port, pop3-stream-length):
* lisp/net/rcirc.el (rcirc-default-port):
* lisp/net/sieve-manage.el (sieve-manage-default-port):
* lisp/play/spook.el (spook-phrase-default-count):
* lisp/play/tetris.el (tetris-buffer-width)
(tetris-buffer-height, tetris-width, tetris-height)
(tetris-top-left-x, tetris-top-left-y):
* lisp/profiler.el (profiler-sampling-interval):
* lisp/progmodes/sql.el (sql-port):
* lisp/recentf.el (recentf-max-menu-items):
* lisp/strokes.el (strokes-grid-resolution):
* lisp/tab-bar.el (tab-bar-tab-name-truncated-max):
* lisp/term/xterm.el (xterm-max-cut-length):
* lisp/time.el (display-time-interval, world-clock-timer-second):
* lisp/url/url-cache.el (url-cache-expire-time):
* lisp/url/url-cookie.el (url-cookie-save-interval):
* lisp/url/url-history.el (url-history-save-interval):
* lisp/url/url-queue.el (url-queue-parallel-processes)
(url-queue-timeout):
* lisp/url/url-vars.el (url-max-password-attempts)
(url-max-redirections):
* lisp/vc/emerge.el (emerge-min-visible-lines):
* lisp/vc/vc.el (vc-log-show-limit):
* lisp/window.el (window-min-height, window-min-width):
* lisp/winner.el (winner-ring-size): Use :type natnum.
* lisp/savehist.el (savehist-file-modes): Fix setting to nil value and
use :type natnum.
2022-07-05 16:26:45 +02:00
|
|
|
:type 'natnum
|
2020-10-08 19:30:12 +02:00
|
|
|
:version "28.1")
|
2020-10-05 06:50:25 +02:00
|
|
|
|
|
|
|
(defcustom dictionary-use-single-buffer
|
|
|
|
nil
|
|
|
|
"Should the dictionary command reuse previous dictionary buffers?"
|
|
|
|
:group 'dictionary
|
2020-10-08 19:30:12 +02:00
|
|
|
:type 'boolean
|
|
|
|
:version "28.1")
|
2020-10-05 06:50:25 +02:00
|
|
|
|
|
|
|
(defcustom dictionary-description-open-delimiter
|
|
|
|
""
|
Various doc fixes in dictionary.el
* lisp/net/dictionary.el (dictionary-set-server-var)
(dictionary-server, dictionary-port)
(dictionary-default-dictionary)
(dictionary-default-popup-strategy, dictionary-proxy-server)
(dictionary-proxy-port, dictionary-description-open-delimiter)
(dictionary-description-close-delimiter)
(dictionary-window-configuration, dictionary-selected-window)
(dictionary-position-stack, dictionary-data-stack)
(dictionary-positions, dictionary-current-data)
(dictionary-connection, dictionary-instances)
(dictionary-color-support, dictionary-word-history)
(dictionary-mode, dictionary, dictionary-check-connection)
(dictionary-mode-p, dictionary-send-command)
(dictionary-read-reply-and-split, dictionary-check-reply)
(dictionary-check-initial-reply, dictionary-store-state)
(dictionary-store-positions, dictionary-new-search)
(dictionary-new-search-internal, dictionary-do-search)
(dictionary-display-search-result)
(dictionary-display-word-definition)
(dictionary-special-dictionary, dictionary-set-strategy)
(dictionary-tooltip-dictionary, dictionary-switch-tooltip-mode)
(dictionary-tooltip-mode, global-dictionary-tooltip-mode): Doc fixes
to adhere to our conventions.
2021-02-07 15:53:46 +01:00
|
|
|
"The delimiter to display in front of the dictionaries description."
|
2020-10-05 06:50:25 +02:00
|
|
|
:group 'dictionary
|
2020-10-08 19:30:12 +02:00
|
|
|
:type 'string
|
|
|
|
:version "28.1")
|
2020-10-05 06:50:25 +02:00
|
|
|
|
|
|
|
(defcustom dictionary-description-close-delimiter
|
|
|
|
""
|
Various doc fixes in dictionary.el
* lisp/net/dictionary.el (dictionary-set-server-var)
(dictionary-server, dictionary-port)
(dictionary-default-dictionary)
(dictionary-default-popup-strategy, dictionary-proxy-server)
(dictionary-proxy-port, dictionary-description-open-delimiter)
(dictionary-description-close-delimiter)
(dictionary-window-configuration, dictionary-selected-window)
(dictionary-position-stack, dictionary-data-stack)
(dictionary-positions, dictionary-current-data)
(dictionary-connection, dictionary-instances)
(dictionary-color-support, dictionary-word-history)
(dictionary-mode, dictionary, dictionary-check-connection)
(dictionary-mode-p, dictionary-send-command)
(dictionary-read-reply-and-split, dictionary-check-reply)
(dictionary-check-initial-reply, dictionary-store-state)
(dictionary-store-positions, dictionary-new-search)
(dictionary-new-search-internal, dictionary-do-search)
(dictionary-display-search-result)
(dictionary-display-word-definition)
(dictionary-special-dictionary, dictionary-set-strategy)
(dictionary-tooltip-dictionary, dictionary-switch-tooltip-mode)
(dictionary-tooltip-mode, global-dictionary-tooltip-mode): Doc fixes
to adhere to our conventions.
2021-02-07 15:53:46 +01:00
|
|
|
"The delimiter to display after of the dictionaries description."
|
2020-10-05 06:50:25 +02:00
|
|
|
:group 'dictionary
|
2020-10-08 19:30:12 +02:00
|
|
|
:type 'string
|
|
|
|
:version "28.1")
|
2020-10-05 06:50:25 +02:00
|
|
|
|
|
|
|
;; Define only when coding-system-list is available
|
2020-10-08 19:33:33 +02:00
|
|
|
(defcustom dictionary-coding-systems-for-dictionaries
|
|
|
|
'( ("mueller" . koi8-r))
|
|
|
|
"Mapping of dictionaries to coding systems.
|
|
|
|
Each entry in this list defines the coding system to be used for that
|
|
|
|
dictionary. The default coding system for all other dictionaries
|
|
|
|
is utf-8"
|
|
|
|
:group 'dictionary
|
|
|
|
:type `(repeat (cons :tag "Association"
|
|
|
|
(string :tag "Dictionary name")
|
|
|
|
(choice :tag "Coding system"
|
|
|
|
:value 'utf-8
|
|
|
|
,@(mapcar (lambda (x) (list 'const x))
|
|
|
|
(coding-system-list))
|
|
|
|
)))
|
|
|
|
:version "28.1")
|
2020-10-05 06:50:25 +02:00
|
|
|
|
2023-05-15 21:04:21 +03:00
|
|
|
(defcustom dictionary-read-word-prompt "Search word"
|
|
|
|
"Prompt string to use when prompting for a word."
|
|
|
|
:type 'string
|
|
|
|
:version "30.1")
|
|
|
|
|
|
|
|
(defcustom dictionary-display-definition-function nil
|
|
|
|
"Function to use for displaying dictionary definitions.
|
|
|
|
It is called with three string arguments: the word being defined,
|
|
|
|
the dictionary name, and the full definition."
|
|
|
|
:type '(choice (const :tag "Dictionary buffer" nil)
|
|
|
|
(const :tag "Help buffer"
|
|
|
|
dictionary-display-definition-in-help-buffer)
|
|
|
|
(function :tag "Custom function"))
|
|
|
|
:version "30.1")
|
|
|
|
|
|
|
|
(defcustom dictionary-read-word-function #'dictionary-read-word-default
|
|
|
|
"Function to use for prompting for a word.
|
|
|
|
It is called with one string argument, the name of the dictionary to use, and
|
|
|
|
must return a string."
|
|
|
|
:type '(choice (const :tag "Default" dictionary-read-word-default)
|
|
|
|
(const :tag "Dictionary-based completion"
|
|
|
|
dictionary-completing-read-word)
|
|
|
|
(function :tag "Custom function"))
|
|
|
|
:version "30.1")
|
|
|
|
|
|
|
|
(defcustom dictionary-read-dictionary-function
|
|
|
|
#'dictionary-read-dictionary-default
|
|
|
|
"Function to use for prompting for a dictionary.
|
|
|
|
It is called with no arguments and must return a string."
|
|
|
|
:type '(choice (const :tag "Default" dictionary-read-dictionary-default)
|
|
|
|
(const :tag "Choose among server-provided dictionaries"
|
|
|
|
dictionary-completing-read-dictionary)
|
|
|
|
(function :tag "Custom function"))
|
|
|
|
:version "30.1")
|
|
|
|
|
|
|
|
(defcustom dictionary-search-interface nil
|
|
|
|
"Controls how `dictionary-search' prompts for words and displays definitions.
|
|
|
|
|
|
|
|
When set to `help', `dictionary-search' displays definitions in a *Help* buffer,
|
|
|
|
and provides completion for word selection based on dictionary matches.
|
|
|
|
|
|
|
|
Otherwise, `dictionary-search' displays definitions in a *Dictionary* buffer."
|
|
|
|
:type '(choice (const :tag "Dictionary buffer" nil)
|
|
|
|
(const :tag "Help buffer" help))
|
|
|
|
:set (lambda (symbol value)
|
|
|
|
(let ((vals (pcase value
|
|
|
|
('help '(dictionary-display-definition-in-help-buffer
|
|
|
|
dictionary-completing-read-word
|
|
|
|
dictionary-completing-read-dictionary))
|
|
|
|
(_ '(nil
|
|
|
|
dictionary-read-word-default
|
|
|
|
dictionary-read-dictionary-default)))))
|
|
|
|
(seq-setq (dictionary-display-definition-function
|
|
|
|
dictionary-read-word-function
|
|
|
|
dictionary-read-dictionary-function)
|
|
|
|
vals))
|
|
|
|
(set-default-toplevel-value symbol value))
|
|
|
|
:version "30.1")
|
|
|
|
|
2020-10-08 19:35:50 +02:00
|
|
|
(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
|
|
|
|
:version "28.1")
|
|
|
|
|
|
|
|
(defface dictionary-word-entry-face
|
|
|
|
'((((type x))
|
|
|
|
(:italic t))
|
|
|
|
(((type tty) (class color))
|
|
|
|
(:foreground "green"))
|
|
|
|
(t
|
|
|
|
(:inverse t)))
|
|
|
|
"The face that is used for displaying the initial word entry line."
|
|
|
|
:group 'dictionary
|
|
|
|
:version "28.1")
|
|
|
|
|
|
|
|
(defface dictionary-button-face
|
|
|
|
'((t
|
|
|
|
(:bold t)))
|
|
|
|
"The face that is used for displaying buttons."
|
|
|
|
:group 'dictionary
|
|
|
|
:version "28.1")
|
|
|
|
|
|
|
|
(defface dictionary-reference-face
|
|
|
|
'((((type x)
|
|
|
|
(class color)
|
|
|
|
(background dark))
|
|
|
|
(:foreground "yellow"))
|
|
|
|
(((type tty)
|
|
|
|
(class color)
|
|
|
|
(background dark))
|
|
|
|
(:foreground "cyan"))
|
|
|
|
(((class color)
|
|
|
|
(background light))
|
|
|
|
(:foreground "blue"))
|
|
|
|
(t
|
|
|
|
(:underline t)))
|
|
|
|
|
|
|
|
"The face that is used for displaying a reference word."
|
|
|
|
:group 'dictionary
|
|
|
|
:version "28.1")
|
2020-10-05 06:50:25 +02:00
|
|
|
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
;; Buffer local variables for storing the current state
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
|
|
|
|
(defvar dictionary-window-configuration
|
|
|
|
nil
|
Various doc fixes in dictionary.el
* lisp/net/dictionary.el (dictionary-set-server-var)
(dictionary-server, dictionary-port)
(dictionary-default-dictionary)
(dictionary-default-popup-strategy, dictionary-proxy-server)
(dictionary-proxy-port, dictionary-description-open-delimiter)
(dictionary-description-close-delimiter)
(dictionary-window-configuration, dictionary-selected-window)
(dictionary-position-stack, dictionary-data-stack)
(dictionary-positions, dictionary-current-data)
(dictionary-connection, dictionary-instances)
(dictionary-color-support, dictionary-word-history)
(dictionary-mode, dictionary, dictionary-check-connection)
(dictionary-mode-p, dictionary-send-command)
(dictionary-read-reply-and-split, dictionary-check-reply)
(dictionary-check-initial-reply, dictionary-store-state)
(dictionary-store-positions, dictionary-new-search)
(dictionary-new-search-internal, dictionary-do-search)
(dictionary-display-search-result)
(dictionary-display-word-definition)
(dictionary-special-dictionary, dictionary-set-strategy)
(dictionary-tooltip-dictionary, dictionary-switch-tooltip-mode)
(dictionary-tooltip-mode, global-dictionary-tooltip-mode): Doc fixes
to adhere to our conventions.
2021-02-07 15:53:46 +01:00
|
|
|
"The window configuration to be restored upon closing the buffer.")
|
2020-10-05 06:50:25 +02:00
|
|
|
|
|
|
|
(defvar dictionary-selected-window
|
|
|
|
nil
|
Various doc fixes in dictionary.el
* lisp/net/dictionary.el (dictionary-set-server-var)
(dictionary-server, dictionary-port)
(dictionary-default-dictionary)
(dictionary-default-popup-strategy, dictionary-proxy-server)
(dictionary-proxy-port, dictionary-description-open-delimiter)
(dictionary-description-close-delimiter)
(dictionary-window-configuration, dictionary-selected-window)
(dictionary-position-stack, dictionary-data-stack)
(dictionary-positions, dictionary-current-data)
(dictionary-connection, dictionary-instances)
(dictionary-color-support, dictionary-word-history)
(dictionary-mode, dictionary, dictionary-check-connection)
(dictionary-mode-p, dictionary-send-command)
(dictionary-read-reply-and-split, dictionary-check-reply)
(dictionary-check-initial-reply, dictionary-store-state)
(dictionary-store-positions, dictionary-new-search)
(dictionary-new-search-internal, dictionary-do-search)
(dictionary-display-search-result)
(dictionary-display-word-definition)
(dictionary-special-dictionary, dictionary-set-strategy)
(dictionary-tooltip-dictionary, dictionary-switch-tooltip-mode)
(dictionary-tooltip-mode, global-dictionary-tooltip-mode): Doc fixes
to adhere to our conventions.
2021-02-07 15:53:46 +01:00
|
|
|
"The currently selected window.")
|
2020-10-05 06:50:25 +02:00
|
|
|
|
|
|
|
(defvar dictionary-position-stack
|
|
|
|
nil
|
Various doc fixes in dictionary.el
* lisp/net/dictionary.el (dictionary-set-server-var)
(dictionary-server, dictionary-port)
(dictionary-default-dictionary)
(dictionary-default-popup-strategy, dictionary-proxy-server)
(dictionary-proxy-port, dictionary-description-open-delimiter)
(dictionary-description-close-delimiter)
(dictionary-window-configuration, dictionary-selected-window)
(dictionary-position-stack, dictionary-data-stack)
(dictionary-positions, dictionary-current-data)
(dictionary-connection, dictionary-instances)
(dictionary-color-support, dictionary-word-history)
(dictionary-mode, dictionary, dictionary-check-connection)
(dictionary-mode-p, dictionary-send-command)
(dictionary-read-reply-and-split, dictionary-check-reply)
(dictionary-check-initial-reply, dictionary-store-state)
(dictionary-store-positions, dictionary-new-search)
(dictionary-new-search-internal, dictionary-do-search)
(dictionary-display-search-result)
(dictionary-display-word-definition)
(dictionary-special-dictionary, dictionary-set-strategy)
(dictionary-tooltip-dictionary, dictionary-switch-tooltip-mode)
(dictionary-tooltip-mode, global-dictionary-tooltip-mode): Doc fixes
to adhere to our conventions.
2021-02-07 15:53:46 +01:00
|
|
|
"The history buffer for point and window position.")
|
2020-10-05 06:50:25 +02:00
|
|
|
|
|
|
|
(defvar dictionary-data-stack
|
|
|
|
nil
|
Various doc fixes in dictionary.el
* lisp/net/dictionary.el (dictionary-set-server-var)
(dictionary-server, dictionary-port)
(dictionary-default-dictionary)
(dictionary-default-popup-strategy, dictionary-proxy-server)
(dictionary-proxy-port, dictionary-description-open-delimiter)
(dictionary-description-close-delimiter)
(dictionary-window-configuration, dictionary-selected-window)
(dictionary-position-stack, dictionary-data-stack)
(dictionary-positions, dictionary-current-data)
(dictionary-connection, dictionary-instances)
(dictionary-color-support, dictionary-word-history)
(dictionary-mode, dictionary, dictionary-check-connection)
(dictionary-mode-p, dictionary-send-command)
(dictionary-read-reply-and-split, dictionary-check-reply)
(dictionary-check-initial-reply, dictionary-store-state)
(dictionary-store-positions, dictionary-new-search)
(dictionary-new-search-internal, dictionary-do-search)
(dictionary-display-search-result)
(dictionary-display-word-definition)
(dictionary-special-dictionary, dictionary-set-strategy)
(dictionary-tooltip-dictionary, dictionary-switch-tooltip-mode)
(dictionary-tooltip-mode, global-dictionary-tooltip-mode): Doc fixes
to adhere to our conventions.
2021-02-07 15:53:46 +01:00
|
|
|
"The history buffer for functions and arguments.")
|
2020-10-05 06:50:25 +02:00
|
|
|
|
|
|
|
(defvar dictionary-positions
|
|
|
|
nil
|
Various doc fixes in dictionary.el
* lisp/net/dictionary.el (dictionary-set-server-var)
(dictionary-server, dictionary-port)
(dictionary-default-dictionary)
(dictionary-default-popup-strategy, dictionary-proxy-server)
(dictionary-proxy-port, dictionary-description-open-delimiter)
(dictionary-description-close-delimiter)
(dictionary-window-configuration, dictionary-selected-window)
(dictionary-position-stack, dictionary-data-stack)
(dictionary-positions, dictionary-current-data)
(dictionary-connection, dictionary-instances)
(dictionary-color-support, dictionary-word-history)
(dictionary-mode, dictionary, dictionary-check-connection)
(dictionary-mode-p, dictionary-send-command)
(dictionary-read-reply-and-split, dictionary-check-reply)
(dictionary-check-initial-reply, dictionary-store-state)
(dictionary-store-positions, dictionary-new-search)
(dictionary-new-search-internal, dictionary-do-search)
(dictionary-display-search-result)
(dictionary-display-word-definition)
(dictionary-special-dictionary, dictionary-set-strategy)
(dictionary-tooltip-dictionary, dictionary-switch-tooltip-mode)
(dictionary-tooltip-mode, global-dictionary-tooltip-mode): Doc fixes
to adhere to our conventions.
2021-02-07 15:53:46 +01:00
|
|
|
"The current positions.")
|
2020-10-05 06:50:25 +02:00
|
|
|
|
|
|
|
(defvar dictionary-current-data
|
|
|
|
nil
|
Various doc fixes in dictionary.el
* lisp/net/dictionary.el (dictionary-set-server-var)
(dictionary-server, dictionary-port)
(dictionary-default-dictionary)
(dictionary-default-popup-strategy, dictionary-proxy-server)
(dictionary-proxy-port, dictionary-description-open-delimiter)
(dictionary-description-close-delimiter)
(dictionary-window-configuration, dictionary-selected-window)
(dictionary-position-stack, dictionary-data-stack)
(dictionary-positions, dictionary-current-data)
(dictionary-connection, dictionary-instances)
(dictionary-color-support, dictionary-word-history)
(dictionary-mode, dictionary, dictionary-check-connection)
(dictionary-mode-p, dictionary-send-command)
(dictionary-read-reply-and-split, dictionary-check-reply)
(dictionary-check-initial-reply, dictionary-store-state)
(dictionary-store-positions, dictionary-new-search)
(dictionary-new-search-internal, dictionary-do-search)
(dictionary-display-search-result)
(dictionary-display-word-definition)
(dictionary-special-dictionary, dictionary-set-strategy)
(dictionary-tooltip-dictionary, dictionary-switch-tooltip-mode)
(dictionary-tooltip-mode, global-dictionary-tooltip-mode): Doc fixes
to adhere to our conventions.
2021-02-07 15:53:46 +01:00
|
|
|
"The item that will be placed on stack next time.")
|
2020-10-05 06:50:25 +02:00
|
|
|
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
;; Global variables
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
2022-07-09 14:38:48 +02:00
|
|
|
(defvar-keymap dictionary-mode-map
|
|
|
|
:doc "Keymap for the dictionary mode."
|
|
|
|
:suppress t :parent button-buffer-map
|
|
|
|
"q" #'dictionary-close
|
2022-07-21 08:56:59 +02:00
|
|
|
"h" #'describe-mode
|
2022-07-09 14:38:48 +02:00
|
|
|
"s" #'dictionary-search
|
|
|
|
"d" #'dictionary-lookup-definition
|
|
|
|
"D" #'dictionary-select-dictionary
|
|
|
|
"M" #'dictionary-select-strategy
|
|
|
|
"m" #'dictionary-match-words
|
|
|
|
"l" #'dictionary-previous
|
|
|
|
"n" #'forward-button
|
|
|
|
"p" #'backward-button
|
|
|
|
"SPC" #'scroll-up-command
|
|
|
|
"S-SPC" #'scroll-down-command
|
2022-11-03 15:16:21 +01:00
|
|
|
"M-SPC" #'scroll-down-command
|
|
|
|
"DEL" #'scroll-down-command)
|
2020-10-05 06:50:25 +02:00
|
|
|
|
|
|
|
(defvar dictionary-connection
|
|
|
|
nil
|
Various doc fixes in dictionary.el
* lisp/net/dictionary.el (dictionary-set-server-var)
(dictionary-server, dictionary-port)
(dictionary-default-dictionary)
(dictionary-default-popup-strategy, dictionary-proxy-server)
(dictionary-proxy-port, dictionary-description-open-delimiter)
(dictionary-description-close-delimiter)
(dictionary-window-configuration, dictionary-selected-window)
(dictionary-position-stack, dictionary-data-stack)
(dictionary-positions, dictionary-current-data)
(dictionary-connection, dictionary-instances)
(dictionary-color-support, dictionary-word-history)
(dictionary-mode, dictionary, dictionary-check-connection)
(dictionary-mode-p, dictionary-send-command)
(dictionary-read-reply-and-split, dictionary-check-reply)
(dictionary-check-initial-reply, dictionary-store-state)
(dictionary-store-positions, dictionary-new-search)
(dictionary-new-search-internal, dictionary-do-search)
(dictionary-display-search-result)
(dictionary-display-word-definition)
(dictionary-special-dictionary, dictionary-set-strategy)
(dictionary-tooltip-dictionary, dictionary-switch-tooltip-mode)
(dictionary-tooltip-mode, global-dictionary-tooltip-mode): Doc fixes
to adhere to our conventions.
2021-02-07 15:53:46 +01:00
|
|
|
"The current network connection.")
|
2020-10-05 06:50:25 +02:00
|
|
|
|
|
|
|
(defvar dictionary-marker
|
|
|
|
nil
|
|
|
|
"Stores the point position while buffer display.")
|
|
|
|
|
2020-11-08 16:08:07 +01:00
|
|
|
(defvar dictionary-word-history
|
|
|
|
'()
|
Various doc fixes in dictionary.el
* lisp/net/dictionary.el (dictionary-set-server-var)
(dictionary-server, dictionary-port)
(dictionary-default-dictionary)
(dictionary-default-popup-strategy, dictionary-proxy-server)
(dictionary-proxy-port, dictionary-description-open-delimiter)
(dictionary-description-close-delimiter)
(dictionary-window-configuration, dictionary-selected-window)
(dictionary-position-stack, dictionary-data-stack)
(dictionary-positions, dictionary-current-data)
(dictionary-connection, dictionary-instances)
(dictionary-color-support, dictionary-word-history)
(dictionary-mode, dictionary, dictionary-check-connection)
(dictionary-mode-p, dictionary-send-command)
(dictionary-read-reply-and-split, dictionary-check-reply)
(dictionary-check-initial-reply, dictionary-store-state)
(dictionary-store-positions, dictionary-new-search)
(dictionary-new-search-internal, dictionary-do-search)
(dictionary-display-search-result)
(dictionary-display-word-definition)
(dictionary-special-dictionary, dictionary-set-strategy)
(dictionary-tooltip-dictionary, dictionary-switch-tooltip-mode)
(dictionary-tooltip-mode, global-dictionary-tooltip-mode): Doc fixes
to adhere to our conventions.
2021-02-07 15:53:46 +01:00
|
|
|
"History list of searched word.")
|
2020-11-08 16:08:07 +01:00
|
|
|
|
2023-05-15 21:04:21 +03:00
|
|
|
(defvar dictionary--last-match nil)
|
|
|
|
|
2020-10-05 06:50:25 +02:00
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
;; Basic function providing startup actions
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
|
|
|
|
;;;###autoload
|
2023-08-12 16:30:08 +02:00
|
|
|
(define-derived-mode dictionary-mode special-mode "Dictionary"
|
A number of docstring fixes
* lisp/net/dictionary.el (dictionary-set-server-var, dictionary-mode,
dictionary, dictionary-new-buffer, dictionary-reply-code,
dictionary-reply, dictionary-reply-list, dictionary-open-server,
dictionary-check-connection, dictionary-mode-p, dictionary-close,
dictionary-read-reply, dictionary-split-string,
dictionary-read-reply-and-split, dictionary-read-answer,
dictionary-check-reply, dictionary-coding-system,
dictionary-decode-charset, dictionary-encode-charset,
dictionary-check-initial-reply, dictionary-store-state,
dictionary-restore-state, dictionary-new-search,
dictionary-new-search-internal, dictionary-do-search,
dictionary-pre-buffer, dictionary-post-buffer,
dictionary-display-search-result, dictionary-display-word-entry,
dictionary-display-word-definition, dictionary-mark-reference,
dictionary-select-dictionary, dictionary-display-dictionarys,
dictionary-display-dictionary-line, dictionary-set-dictionary,
dictionary-special-dictionary, dictionary-display-more-info,
dictionary-select-strategy, dictionary-do-select-strategy,
dictionary-display-strategies, dictionary-display-strategy-line,
dictionary-set-strategy, dictionary-new-matching,
dictionary-do-matching, dictionary-display-only-match-result,
dictionary-display-match-result, dictionary-display-match-result,
dictionary-display-match-lines, dictionary-search,
dictionary-previous, dictionary-help, dictionary-match-words,
dictionary-mouse-popup-matching-words,
dictionary-popup-matching-words, dictionary-tooltip-mode,
dictionary-tooltip-mouse-event): Fix docstring
The following kind of changes were made:
- finish first line with a full stop (.)
- mention parameter in upper-case whenever possible (considering the
length constraints)
2020-12-14 10:55:35 +01:00
|
|
|
"Mode for searching a dictionary.
|
2023-08-12 16:40:10 +02:00
|
|
|
|
A number of docstring fixes
* lisp/net/dictionary.el (dictionary-set-server-var, dictionary-mode,
dictionary, dictionary-new-buffer, dictionary-reply-code,
dictionary-reply, dictionary-reply-list, dictionary-open-server,
dictionary-check-connection, dictionary-mode-p, dictionary-close,
dictionary-read-reply, dictionary-split-string,
dictionary-read-reply-and-split, dictionary-read-answer,
dictionary-check-reply, dictionary-coding-system,
dictionary-decode-charset, dictionary-encode-charset,
dictionary-check-initial-reply, dictionary-store-state,
dictionary-restore-state, dictionary-new-search,
dictionary-new-search-internal, dictionary-do-search,
dictionary-pre-buffer, dictionary-post-buffer,
dictionary-display-search-result, dictionary-display-word-entry,
dictionary-display-word-definition, dictionary-mark-reference,
dictionary-select-dictionary, dictionary-display-dictionarys,
dictionary-display-dictionary-line, dictionary-set-dictionary,
dictionary-special-dictionary, dictionary-display-more-info,
dictionary-select-strategy, dictionary-do-select-strategy,
dictionary-display-strategies, dictionary-display-strategy-line,
dictionary-set-strategy, dictionary-new-matching,
dictionary-do-matching, dictionary-display-only-match-result,
dictionary-display-match-result, dictionary-display-match-result,
dictionary-display-match-lines, dictionary-search,
dictionary-previous, dictionary-help, dictionary-match-words,
dictionary-mouse-popup-matching-words,
dictionary-popup-matching-words, dictionary-tooltip-mode,
dictionary-tooltip-mouse-event): Fix docstring
The following kind of changes were made:
- finish first line with a full stop (.)
- mention parameter in upper-case whenever possible (considering the
length constraints)
2020-12-14 10:55:35 +01:00
|
|
|
This is a mode for searching a dictionary server implementing the
|
|
|
|
protocol defined in RFC 2229.
|
2020-10-05 06:50:25 +02:00
|
|
|
|
A number of docstring fixes
* lisp/net/dictionary.el (dictionary-set-server-var, dictionary-mode,
dictionary, dictionary-new-buffer, dictionary-reply-code,
dictionary-reply, dictionary-reply-list, dictionary-open-server,
dictionary-check-connection, dictionary-mode-p, dictionary-close,
dictionary-read-reply, dictionary-split-string,
dictionary-read-reply-and-split, dictionary-read-answer,
dictionary-check-reply, dictionary-coding-system,
dictionary-decode-charset, dictionary-encode-charset,
dictionary-check-initial-reply, dictionary-store-state,
dictionary-restore-state, dictionary-new-search,
dictionary-new-search-internal, dictionary-do-search,
dictionary-pre-buffer, dictionary-post-buffer,
dictionary-display-search-result, dictionary-display-word-entry,
dictionary-display-word-definition, dictionary-mark-reference,
dictionary-select-dictionary, dictionary-display-dictionarys,
dictionary-display-dictionary-line, dictionary-set-dictionary,
dictionary-special-dictionary, dictionary-display-more-info,
dictionary-select-strategy, dictionary-do-select-strategy,
dictionary-display-strategies, dictionary-display-strategy-line,
dictionary-set-strategy, dictionary-new-matching,
dictionary-do-matching, dictionary-display-only-match-result,
dictionary-display-match-result, dictionary-display-match-result,
dictionary-display-match-lines, dictionary-search,
dictionary-previous, dictionary-help, dictionary-match-words,
dictionary-mouse-popup-matching-words,
dictionary-popup-matching-words, dictionary-tooltip-mode,
dictionary-tooltip-mouse-event): Fix docstring
The following kind of changes were made:
- finish first line with a full stop (.)
- mention parameter in upper-case whenever possible (considering the
length constraints)
2020-12-14 10:55:35 +01:00
|
|
|
This is a quick reference to this mode describing the default key bindings:
|
Various doc fixes in dictionary.el
* lisp/net/dictionary.el (dictionary-set-server-var)
(dictionary-server, dictionary-port)
(dictionary-default-dictionary)
(dictionary-default-popup-strategy, dictionary-proxy-server)
(dictionary-proxy-port, dictionary-description-open-delimiter)
(dictionary-description-close-delimiter)
(dictionary-window-configuration, dictionary-selected-window)
(dictionary-position-stack, dictionary-data-stack)
(dictionary-positions, dictionary-current-data)
(dictionary-connection, dictionary-instances)
(dictionary-color-support, dictionary-word-history)
(dictionary-mode, dictionary, dictionary-check-connection)
(dictionary-mode-p, dictionary-send-command)
(dictionary-read-reply-and-split, dictionary-check-reply)
(dictionary-check-initial-reply, dictionary-store-state)
(dictionary-store-positions, dictionary-new-search)
(dictionary-new-search-internal, dictionary-do-search)
(dictionary-display-search-result)
(dictionary-display-word-definition)
(dictionary-special-dictionary, dictionary-set-strategy)
(dictionary-tooltip-dictionary, dictionary-switch-tooltip-mode)
(dictionary-tooltip-mode, global-dictionary-tooltip-mode): Doc fixes
to adhere to our conventions.
2021-02-07 15:53:46 +01:00
|
|
|
\\<dictionary-mode-map>
|
2023-08-12 16:40:10 +02:00
|
|
|
\\[dictionary-close] close the dictionary buffer
|
|
|
|
\\[describe-mode] display this help
|
|
|
|
\\[dictionary-search] ask for a new word to search
|
|
|
|
\\[dictionary-lookup-definition] search for word at point
|
|
|
|
\\[forward-button] or \\`TAB' move point to the next link
|
|
|
|
\\[backward-button] or \\`S-TAB' move point to the previous link
|
|
|
|
|
|
|
|
\\[dictionary-match-words] ask for a pattern and list all matching words
|
|
|
|
\\[dictionary-select-dictionary] select the default dictionary
|
|
|
|
\\[dictionary-select-strategy] select the default search strategy
|
|
|
|
|
|
|
|
\\`RET' visit link at point
|
|
|
|
\\`<mouse-2>' visit clicked link"
|
2020-10-05 06:50:25 +02:00
|
|
|
(buffer-disable-undo)
|
2020-12-14 09:40:33 +01:00
|
|
|
(setq-local dictionary-data-stack nil)
|
|
|
|
(setq-local dictionary-position-stack nil)
|
2020-10-05 06:50:25 +02:00
|
|
|
(make-local-variable 'dictionary-current-data)
|
|
|
|
(make-local-variable 'dictionary-positions)
|
|
|
|
(make-local-variable 'dictionary-default-dictionary)
|
|
|
|
(make-local-variable 'dictionary-default-strategy)
|
2023-08-12 16:30:08 +02:00
|
|
|
(add-hook 'kill-buffer-hook #'dictionary-close t t))
|
2020-10-05 06:50:25 +02:00
|
|
|
|
|
|
|
;;;###autoload
|
|
|
|
(defun dictionary ()
|
Fix typos
* doc/lispref/display.texi (Size of Displayed Text):
* doc/lispref/windows.texi (Buffer Display Action Functions):
* etc/NEWS:
* etc/ORG-NEWS (Org-Attach has been refactored and extended):
* lisp/battery.el (display-battery-mode, battery--upower-subsribe):
* lisp/calendar/parse-time.el:
* lisp/dired-x.el:
* lisp/emacs-lisp/chart.el (chart-sequece, chart-bar-quickie):
* lisp/emacs-lisp/eldoc.el (eldoc-echo-area-use-multiline-p)
(eldoc-documentation-strategy):
* lisp/emacs-lisp/pcase.el (pcase--split-pred, pcase--u1):
* lisp/gnus/gnus-search.el (gnus-search-expandable-keys)
(gnus-search-parse-query, gnus-search-query-return-string)
(gnus-search-imap, gnus-search-imap-search-command)
(gnus-search-transform-expression):
* lisp/gnus/nnselect.el:
* lisp/isearch.el (isearch-lazy-count-format):
* lisp/mh-e/mh-show.el (mh-show-msg):
* lisp/net/dictionary-connection.el (dictionary-connection-open):
* lisp/net/dictionary.el (dictionary-default-popup-strategy)
(dictionary, dictionary-split-string, dictionary-do-select-dictionary)
(dictionary-display-dictionarys, dictionary-search)
(dictionary-tooltip-mode):
* lisp/net/eudcb-macos-contacts.el (eudc-macos-contacts-set-server):
* lisp/net/mailcap.el (mailcap-mime-data):
* lisp/net/tramp-smb.el (tramp-smb-maybe-open-connection):
* lisp/nxml/nxml-mode.el (nxml-mode):
* lisp/progmodes/cc-engine.el:
* lisp/progmodes/cperl-mode.el (cperl-mode)
(cperl-fontify-syntaxically):
* lisp/progmodes/flymake.el (flymake-diagnostic-functions):
* lisp/progmodes/verilog-mode.el (verilog--supressed-warnings)
(verilog-preprocess):
* lisp/simple.el (self-insert-uses-region-functions):
* lisp/textmodes/bibtex.el (bibtex-copy-summary-as-kill):
* lisp/textmodes/texnfo-upd.el (texinfo-insert-master-menu-list):
* src/dispnew.c:
* src/font.c (Ffont_get):
* src/indent.c (compute_motion):
* src/process.c (init_process_emacs):
* src/w32fns.c (deliver_wm_chars):
* test/lisp/jsonrpc-tests.el (deferred-action-complex-tests):
Fix typos in documentation, comments, and internal identifiers.
2021-02-18 16:41:36 +01:00
|
|
|
"Create a new dictionary buffer and install `dictionary-mode'."
|
2020-10-05 06:50:25 +02:00
|
|
|
(interactive)
|
|
|
|
(let ((buffer (or (and dictionary-use-single-buffer
|
|
|
|
(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)
|
|
|
|
|
2020-12-14 09:40:33 +01:00
|
|
|
(setq-local dictionary-window-configuration window-configuration)
|
|
|
|
(setq-local dictionary-selected-window selected-window)
|
2020-10-05 06:50:25 +02:00
|
|
|
(dictionary-check-connection)
|
|
|
|
(dictionary-new-buffer)
|
|
|
|
(dictionary-store-positions)
|
|
|
|
(dictionary-store-state 'dictionary-new-buffer nil)))
|
|
|
|
|
2020-11-19 21:39:10 +01:00
|
|
|
(defun dictionary-new-buffer ()
|
A number of docstring fixes
* lisp/net/dictionary.el (dictionary-set-server-var, dictionary-mode,
dictionary, dictionary-new-buffer, dictionary-reply-code,
dictionary-reply, dictionary-reply-list, dictionary-open-server,
dictionary-check-connection, dictionary-mode-p, dictionary-close,
dictionary-read-reply, dictionary-split-string,
dictionary-read-reply-and-split, dictionary-read-answer,
dictionary-check-reply, dictionary-coding-system,
dictionary-decode-charset, dictionary-encode-charset,
dictionary-check-initial-reply, dictionary-store-state,
dictionary-restore-state, dictionary-new-search,
dictionary-new-search-internal, dictionary-do-search,
dictionary-pre-buffer, dictionary-post-buffer,
dictionary-display-search-result, dictionary-display-word-entry,
dictionary-display-word-definition, dictionary-mark-reference,
dictionary-select-dictionary, dictionary-display-dictionarys,
dictionary-display-dictionary-line, dictionary-set-dictionary,
dictionary-special-dictionary, dictionary-display-more-info,
dictionary-select-strategy, dictionary-do-select-strategy,
dictionary-display-strategies, dictionary-display-strategy-line,
dictionary-set-strategy, dictionary-new-matching,
dictionary-do-matching, dictionary-display-only-match-result,
dictionary-display-match-result, dictionary-display-match-result,
dictionary-display-match-lines, dictionary-search,
dictionary-previous, dictionary-help, dictionary-match-words,
dictionary-mouse-popup-matching-words,
dictionary-popup-matching-words, dictionary-tooltip-mode,
dictionary-tooltip-mouse-event): Fix docstring
The following kind of changes were made:
- finish first line with a full stop (.)
- mention parameter in upper-case whenever possible (considering the
length constraints)
2020-12-14 10:55:35 +01:00
|
|
|
"Create a new and clean buffer."
|
2020-10-05 06:50:25 +02:00
|
|
|
|
|
|
|
(dictionary-pre-buffer)
|
|
|
|
(dictionary-post-buffer))
|
|
|
|
|
2020-12-14 09:34:44 +01:00
|
|
|
(defsubst dictionary-reply-code (reply)
|
A number of docstring fixes
* lisp/net/dictionary.el (dictionary-set-server-var, dictionary-mode,
dictionary, dictionary-new-buffer, dictionary-reply-code,
dictionary-reply, dictionary-reply-list, dictionary-open-server,
dictionary-check-connection, dictionary-mode-p, dictionary-close,
dictionary-read-reply, dictionary-split-string,
dictionary-read-reply-and-split, dictionary-read-answer,
dictionary-check-reply, dictionary-coding-system,
dictionary-decode-charset, dictionary-encode-charset,
dictionary-check-initial-reply, dictionary-store-state,
dictionary-restore-state, dictionary-new-search,
dictionary-new-search-internal, dictionary-do-search,
dictionary-pre-buffer, dictionary-post-buffer,
dictionary-display-search-result, dictionary-display-word-entry,
dictionary-display-word-definition, dictionary-mark-reference,
dictionary-select-dictionary, dictionary-display-dictionarys,
dictionary-display-dictionary-line, dictionary-set-dictionary,
dictionary-special-dictionary, dictionary-display-more-info,
dictionary-select-strategy, dictionary-do-select-strategy,
dictionary-display-strategies, dictionary-display-strategy-line,
dictionary-set-strategy, dictionary-new-matching,
dictionary-do-matching, dictionary-display-only-match-result,
dictionary-display-match-result, dictionary-display-match-result,
dictionary-display-match-lines, dictionary-search,
dictionary-previous, dictionary-help, dictionary-match-words,
dictionary-mouse-popup-matching-words,
dictionary-popup-matching-words, dictionary-tooltip-mode,
dictionary-tooltip-mouse-event): Fix docstring
The following kind of changes were made:
- finish first line with a full stop (.)
- mention parameter in upper-case whenever possible (considering the
length constraints)
2020-12-14 10:55:35 +01:00
|
|
|
"Return the reply code stored in REPLY."
|
2020-12-14 09:34:44 +01:00
|
|
|
(get reply 'reply-code))
|
2020-10-05 06:50:25 +02:00
|
|
|
|
2020-12-14 09:34:44 +01:00
|
|
|
(defsubst dictionary-reply (reply)
|
A number of docstring fixes
* lisp/net/dictionary.el (dictionary-set-server-var, dictionary-mode,
dictionary, dictionary-new-buffer, dictionary-reply-code,
dictionary-reply, dictionary-reply-list, dictionary-open-server,
dictionary-check-connection, dictionary-mode-p, dictionary-close,
dictionary-read-reply, dictionary-split-string,
dictionary-read-reply-and-split, dictionary-read-answer,
dictionary-check-reply, dictionary-coding-system,
dictionary-decode-charset, dictionary-encode-charset,
dictionary-check-initial-reply, dictionary-store-state,
dictionary-restore-state, dictionary-new-search,
dictionary-new-search-internal, dictionary-do-search,
dictionary-pre-buffer, dictionary-post-buffer,
dictionary-display-search-result, dictionary-display-word-entry,
dictionary-display-word-definition, dictionary-mark-reference,
dictionary-select-dictionary, dictionary-display-dictionarys,
dictionary-display-dictionary-line, dictionary-set-dictionary,
dictionary-special-dictionary, dictionary-display-more-info,
dictionary-select-strategy, dictionary-do-select-strategy,
dictionary-display-strategies, dictionary-display-strategy-line,
dictionary-set-strategy, dictionary-new-matching,
dictionary-do-matching, dictionary-display-only-match-result,
dictionary-display-match-result, dictionary-display-match-result,
dictionary-display-match-lines, dictionary-search,
dictionary-previous, dictionary-help, dictionary-match-words,
dictionary-mouse-popup-matching-words,
dictionary-popup-matching-words, dictionary-tooltip-mode,
dictionary-tooltip-mouse-event): Fix docstring
The following kind of changes were made:
- finish first line with a full stop (.)
- mention parameter in upper-case whenever possible (considering the
length constraints)
2020-12-14 10:55:35 +01:00
|
|
|
"Return the string reply stored in REPLY."
|
2020-12-14 09:34:44 +01:00
|
|
|
(get reply 'reply))
|
2020-10-05 06:50:25 +02:00
|
|
|
|
2020-12-14 09:34:44 +01:00
|
|
|
(defsubst dictionary-reply-list (reply)
|
A number of docstring fixes
* lisp/net/dictionary.el (dictionary-set-server-var, dictionary-mode,
dictionary, dictionary-new-buffer, dictionary-reply-code,
dictionary-reply, dictionary-reply-list, dictionary-open-server,
dictionary-check-connection, dictionary-mode-p, dictionary-close,
dictionary-read-reply, dictionary-split-string,
dictionary-read-reply-and-split, dictionary-read-answer,
dictionary-check-reply, dictionary-coding-system,
dictionary-decode-charset, dictionary-encode-charset,
dictionary-check-initial-reply, dictionary-store-state,
dictionary-restore-state, dictionary-new-search,
dictionary-new-search-internal, dictionary-do-search,
dictionary-pre-buffer, dictionary-post-buffer,
dictionary-display-search-result, dictionary-display-word-entry,
dictionary-display-word-definition, dictionary-mark-reference,
dictionary-select-dictionary, dictionary-display-dictionarys,
dictionary-display-dictionary-line, dictionary-set-dictionary,
dictionary-special-dictionary, dictionary-display-more-info,
dictionary-select-strategy, dictionary-do-select-strategy,
dictionary-display-strategies, dictionary-display-strategy-line,
dictionary-set-strategy, dictionary-new-matching,
dictionary-do-matching, dictionary-display-only-match-result,
dictionary-display-match-result, dictionary-display-match-result,
dictionary-display-match-lines, dictionary-search,
dictionary-previous, dictionary-help, dictionary-match-words,
dictionary-mouse-popup-matching-words,
dictionary-popup-matching-words, dictionary-tooltip-mode,
dictionary-tooltip-mouse-event): Fix docstring
The following kind of changes were made:
- finish first line with a full stop (.)
- mention parameter in upper-case whenever possible (considering the
length constraints)
2020-12-14 10:55:35 +01:00
|
|
|
"Return the reply list stored in REPLY."
|
2020-12-14 09:34:44 +01:00
|
|
|
(get reply 'reply-list))
|
2020-10-05 06:50:25 +02:00
|
|
|
|
2020-11-19 08:23:07 +01:00
|
|
|
(defun dictionary-open-server (server)
|
A number of docstring fixes
* lisp/net/dictionary.el (dictionary-set-server-var, dictionary-mode,
dictionary, dictionary-new-buffer, dictionary-reply-code,
dictionary-reply, dictionary-reply-list, dictionary-open-server,
dictionary-check-connection, dictionary-mode-p, dictionary-close,
dictionary-read-reply, dictionary-split-string,
dictionary-read-reply-and-split, dictionary-read-answer,
dictionary-check-reply, dictionary-coding-system,
dictionary-decode-charset, dictionary-encode-charset,
dictionary-check-initial-reply, dictionary-store-state,
dictionary-restore-state, dictionary-new-search,
dictionary-new-search-internal, dictionary-do-search,
dictionary-pre-buffer, dictionary-post-buffer,
dictionary-display-search-result, dictionary-display-word-entry,
dictionary-display-word-definition, dictionary-mark-reference,
dictionary-select-dictionary, dictionary-display-dictionarys,
dictionary-display-dictionary-line, dictionary-set-dictionary,
dictionary-special-dictionary, dictionary-display-more-info,
dictionary-select-strategy, dictionary-do-select-strategy,
dictionary-display-strategies, dictionary-display-strategy-line,
dictionary-set-strategy, dictionary-new-matching,
dictionary-do-matching, dictionary-display-only-match-result,
dictionary-display-match-result, dictionary-display-match-result,
dictionary-display-match-lines, dictionary-search,
dictionary-previous, dictionary-help, dictionary-match-words,
dictionary-mouse-popup-matching-words,
dictionary-popup-matching-words, dictionary-tooltip-mode,
dictionary-tooltip-mouse-event): Fix docstring
The following kind of changes were made:
- finish first line with a full stop (.)
- mention parameter in upper-case whenever possible (considering the
length constraints)
2020-12-14 10:55:35 +01:00
|
|
|
"Opens a new connection to SERVER.
|
|
|
|
The connection takes the proxy setting in customization group
|
|
|
|
`dictionary-proxy' into account."
|
2020-11-19 08:23:07 +01:00
|
|
|
(let ((wanted 'raw-text)
|
|
|
|
(coding-system nil))
|
|
|
|
(if (member wanted (coding-system-list))
|
|
|
|
(setq coding-system wanted))
|
|
|
|
(let ((coding-system-for-read coding-system)
|
|
|
|
(coding-system-for-write coding-system))
|
|
|
|
(setq dictionary-current-server server)
|
|
|
|
(message "Opening connection to %s:%s" server
|
|
|
|
dictionary-port)
|
|
|
|
(dictionary-connection-close dictionary-connection)
|
|
|
|
(setq dictionary-connection
|
|
|
|
(if dictionary-use-http-proxy
|
|
|
|
(dictionary-connection-open dictionary-proxy-server
|
|
|
|
dictionary-proxy-port)
|
|
|
|
(dictionary-connection-open server dictionary-port)))
|
|
|
|
(set-process-query-on-exit-flag
|
|
|
|
(dictionary-connection-process dictionary-connection)
|
|
|
|
nil)
|
|
|
|
|
|
|
|
(when dictionary-use-http-proxy
|
|
|
|
(message "Proxy CONNECT to %s:%d"
|
|
|
|
dictionary-proxy-server
|
|
|
|
dictionary-proxy-port)
|
|
|
|
(dictionary-send-command (format "CONNECT %s:%d HTTP/1.1"
|
|
|
|
server
|
|
|
|
dictionary-port))
|
|
|
|
;; just a \r\n combination
|
|
|
|
(dictionary-send-command "")
|
|
|
|
|
|
|
|
;; read first line of reply
|
|
|
|
(let* ((reply (dictionary-read-reply))
|
|
|
|
(reply-list (dictionary-split-string reply)))
|
|
|
|
;; first item is protocol, second item is code
|
|
|
|
(unless (= (string-to-number (cadr reply-list)) 200)
|
|
|
|
(error "Bad reply from proxy server %s" reply))
|
|
|
|
|
|
|
|
;; skip the following header lines until empty found
|
|
|
|
(while (not (equal reply ""))
|
|
|
|
(setq reply (dictionary-read-reply)))))
|
|
|
|
|
|
|
|
(dictionary-check-initial-reply)
|
|
|
|
(dictionary-send-command (concat "client " dictionary-identification))
|
|
|
|
(let ((reply (dictionary-read-reply-and-split)))
|
|
|
|
(message nil)
|
|
|
|
(unless (dictionary-check-reply reply 250)
|
|
|
|
(error "Unknown server answer: %s"
|
|
|
|
(dictionary-reply reply)))))))
|
|
|
|
|
2020-10-05 06:50:25 +02:00
|
|
|
(defun dictionary-check-connection ()
|
A number of docstring fixes
* lisp/net/dictionary.el (dictionary-set-server-var, dictionary-mode,
dictionary, dictionary-new-buffer, dictionary-reply-code,
dictionary-reply, dictionary-reply-list, dictionary-open-server,
dictionary-check-connection, dictionary-mode-p, dictionary-close,
dictionary-read-reply, dictionary-split-string,
dictionary-read-reply-and-split, dictionary-read-answer,
dictionary-check-reply, dictionary-coding-system,
dictionary-decode-charset, dictionary-encode-charset,
dictionary-check-initial-reply, dictionary-store-state,
dictionary-restore-state, dictionary-new-search,
dictionary-new-search-internal, dictionary-do-search,
dictionary-pre-buffer, dictionary-post-buffer,
dictionary-display-search-result, dictionary-display-word-entry,
dictionary-display-word-definition, dictionary-mark-reference,
dictionary-select-dictionary, dictionary-display-dictionarys,
dictionary-display-dictionary-line, dictionary-set-dictionary,
dictionary-special-dictionary, dictionary-display-more-info,
dictionary-select-strategy, dictionary-do-select-strategy,
dictionary-display-strategies, dictionary-display-strategy-line,
dictionary-set-strategy, dictionary-new-matching,
dictionary-do-matching, dictionary-display-only-match-result,
dictionary-display-match-result, dictionary-display-match-result,
dictionary-display-match-lines, dictionary-search,
dictionary-previous, dictionary-help, dictionary-match-words,
dictionary-mouse-popup-matching-words,
dictionary-popup-matching-words, dictionary-tooltip-mode,
dictionary-tooltip-mouse-event): Fix docstring
The following kind of changes were made:
- finish first line with a full stop (.)
- mention parameter in upper-case whenever possible (considering the
length constraints)
2020-12-14 10:55:35 +01:00
|
|
|
"Check if there is already a connection open."
|
2020-10-05 06:50:25 +02:00
|
|
|
(if (not (and dictionary-connection
|
2020-10-05 06:56:59 +02:00
|
|
|
(eq (dictionary-connection-status dictionary-connection) 'up)))
|
2020-11-19 08:23:07 +01:00
|
|
|
(if dictionary-server
|
|
|
|
(dictionary-open-server dictionary-server)
|
|
|
|
(let ((server "localhost"))
|
|
|
|
(condition-case nil
|
|
|
|
(dictionary-open-server server)
|
|
|
|
(error
|
|
|
|
(if (y-or-n-p
|
Various doc fixes in dictionary.el
* lisp/net/dictionary.el (dictionary-set-server-var)
(dictionary-server, dictionary-port)
(dictionary-default-dictionary)
(dictionary-default-popup-strategy, dictionary-proxy-server)
(dictionary-proxy-port, dictionary-description-open-delimiter)
(dictionary-description-close-delimiter)
(dictionary-window-configuration, dictionary-selected-window)
(dictionary-position-stack, dictionary-data-stack)
(dictionary-positions, dictionary-current-data)
(dictionary-connection, dictionary-instances)
(dictionary-color-support, dictionary-word-history)
(dictionary-mode, dictionary, dictionary-check-connection)
(dictionary-mode-p, dictionary-send-command)
(dictionary-read-reply-and-split, dictionary-check-reply)
(dictionary-check-initial-reply, dictionary-store-state)
(dictionary-store-positions, dictionary-new-search)
(dictionary-new-search-internal, dictionary-do-search)
(dictionary-display-search-result)
(dictionary-display-word-definition)
(dictionary-special-dictionary, dictionary-set-strategy)
(dictionary-tooltip-dictionary, dictionary-switch-tooltip-mode)
(dictionary-tooltip-mode, global-dictionary-tooltip-mode): Doc fixes
to adhere to our conventions.
2021-02-07 15:53:46 +01:00
|
|
|
(format "Failed to open server %s, continue with dict.org? "
|
2020-11-19 08:23:07 +01:00
|
|
|
server))
|
|
|
|
(dictionary-open-server "dict.org")
|
|
|
|
(error "Failed automatic server selection, please customize dictionary-server"))))))))
|
2020-10-05 06:50:25 +02:00
|
|
|
|
|
|
|
(defun dictionary-mode-p ()
|
Various doc fixes in dictionary.el
* lisp/net/dictionary.el (dictionary-set-server-var)
(dictionary-server, dictionary-port)
(dictionary-default-dictionary)
(dictionary-default-popup-strategy, dictionary-proxy-server)
(dictionary-proxy-port, dictionary-description-open-delimiter)
(dictionary-description-close-delimiter)
(dictionary-window-configuration, dictionary-selected-window)
(dictionary-position-stack, dictionary-data-stack)
(dictionary-positions, dictionary-current-data)
(dictionary-connection, dictionary-instances)
(dictionary-color-support, dictionary-word-history)
(dictionary-mode, dictionary, dictionary-check-connection)
(dictionary-mode-p, dictionary-send-command)
(dictionary-read-reply-and-split, dictionary-check-reply)
(dictionary-check-initial-reply, dictionary-store-state)
(dictionary-store-positions, dictionary-new-search)
(dictionary-new-search-internal, dictionary-do-search)
(dictionary-display-search-result)
(dictionary-display-word-definition)
(dictionary-special-dictionary, dictionary-set-strategy)
(dictionary-tooltip-dictionary, dictionary-switch-tooltip-mode)
(dictionary-tooltip-mode, global-dictionary-tooltip-mode): Doc fixes
to adhere to our conventions.
2021-02-07 15:53:46 +01:00
|
|
|
"Return non-nil if current buffer has `dictionary-mode'."
|
2020-10-05 06:50:25 +02:00
|
|
|
(eq major-mode 'dictionary-mode))
|
|
|
|
|
|
|
|
(defun dictionary-ensure-buffer ()
|
|
|
|
"If current buffer is not a dictionary buffer, create a new one."
|
|
|
|
(unless (dictionary-mode-p)
|
|
|
|
(dictionary)))
|
|
|
|
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
;; Dealing with closing the buffer
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
|
2021-03-08 10:11:22 -05:00
|
|
|
(defun dictionary-close (&rest _ignored)
|
A number of docstring fixes
* lisp/net/dictionary.el (dictionary-set-server-var, dictionary-mode,
dictionary, dictionary-new-buffer, dictionary-reply-code,
dictionary-reply, dictionary-reply-list, dictionary-open-server,
dictionary-check-connection, dictionary-mode-p, dictionary-close,
dictionary-read-reply, dictionary-split-string,
dictionary-read-reply-and-split, dictionary-read-answer,
dictionary-check-reply, dictionary-coding-system,
dictionary-decode-charset, dictionary-encode-charset,
dictionary-check-initial-reply, dictionary-store-state,
dictionary-restore-state, dictionary-new-search,
dictionary-new-search-internal, dictionary-do-search,
dictionary-pre-buffer, dictionary-post-buffer,
dictionary-display-search-result, dictionary-display-word-entry,
dictionary-display-word-definition, dictionary-mark-reference,
dictionary-select-dictionary, dictionary-display-dictionarys,
dictionary-display-dictionary-line, dictionary-set-dictionary,
dictionary-special-dictionary, dictionary-display-more-info,
dictionary-select-strategy, dictionary-do-select-strategy,
dictionary-display-strategies, dictionary-display-strategy-line,
dictionary-set-strategy, dictionary-new-matching,
dictionary-do-matching, dictionary-display-only-match-result,
dictionary-display-match-result, dictionary-display-match-result,
dictionary-display-match-lines, dictionary-search,
dictionary-previous, dictionary-help, dictionary-match-words,
dictionary-mouse-popup-matching-words,
dictionary-popup-matching-words, dictionary-tooltip-mode,
dictionary-tooltip-mouse-event): Fix docstring
The following kind of changes were made:
- finish first line with a full stop (.)
- mention parameter in upper-case whenever possible (considering the
length constraints)
2020-12-14 10:55:35 +01:00
|
|
|
"Close the current dictionary buffer and its connection."
|
2020-10-05 06:50:25 +02:00
|
|
|
(interactive)
|
2023-08-12 16:30:08 +02:00
|
|
|
(when (derived-mode-p 'dictionary-mode)
|
|
|
|
(setq major-mode nil)
|
2023-08-19 13:03:46 +02:00
|
|
|
(if (<= (length (match-buffers '(derived-mode . dictionary-mode))) 0)
|
2023-08-12 16:30:08 +02:00
|
|
|
(dictionary-connection-close dictionary-connection))
|
|
|
|
(let ((configuration dictionary-window-configuration)
|
|
|
|
(selected-window dictionary-selected-window))
|
|
|
|
(kill-buffer (current-buffer))
|
|
|
|
(set-window-configuration configuration)
|
|
|
|
(select-window selected-window))))
|
2020-10-05 06:50:25 +02:00
|
|
|
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
;; Helpful functions
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
|
|
|
|
(defun dictionary-send-command (string)
|
Various doc fixes in dictionary.el
* lisp/net/dictionary.el (dictionary-set-server-var)
(dictionary-server, dictionary-port)
(dictionary-default-dictionary)
(dictionary-default-popup-strategy, dictionary-proxy-server)
(dictionary-proxy-port, dictionary-description-open-delimiter)
(dictionary-description-close-delimiter)
(dictionary-window-configuration, dictionary-selected-window)
(dictionary-position-stack, dictionary-data-stack)
(dictionary-positions, dictionary-current-data)
(dictionary-connection, dictionary-instances)
(dictionary-color-support, dictionary-word-history)
(dictionary-mode, dictionary, dictionary-check-connection)
(dictionary-mode-p, dictionary-send-command)
(dictionary-read-reply-and-split, dictionary-check-reply)
(dictionary-check-initial-reply, dictionary-store-state)
(dictionary-store-positions, dictionary-new-search)
(dictionary-new-search-internal, dictionary-do-search)
(dictionary-display-search-result)
(dictionary-display-word-definition)
(dictionary-special-dictionary, dictionary-set-strategy)
(dictionary-tooltip-dictionary, dictionary-switch-tooltip-mode)
(dictionary-tooltip-mode, global-dictionary-tooltip-mode): Doc fixes
to adhere to our conventions.
2021-02-07 15:53:46 +01:00
|
|
|
"Send the command STRING to the network connection."
|
2020-10-05 06:50:25 +02:00
|
|
|
(dictionary-check-connection)
|
|
|
|
;;;; #####
|
2020-10-05 06:56:59 +02:00
|
|
|
(dictionary-connection-send-crlf dictionary-connection string))
|
2020-10-05 06:50:25 +02:00
|
|
|
|
|
|
|
(defun dictionary-read-reply ()
|
A number of docstring fixes
* lisp/net/dictionary.el (dictionary-set-server-var, dictionary-mode,
dictionary, dictionary-new-buffer, dictionary-reply-code,
dictionary-reply, dictionary-reply-list, dictionary-open-server,
dictionary-check-connection, dictionary-mode-p, dictionary-close,
dictionary-read-reply, dictionary-split-string,
dictionary-read-reply-and-split, dictionary-read-answer,
dictionary-check-reply, dictionary-coding-system,
dictionary-decode-charset, dictionary-encode-charset,
dictionary-check-initial-reply, dictionary-store-state,
dictionary-restore-state, dictionary-new-search,
dictionary-new-search-internal, dictionary-do-search,
dictionary-pre-buffer, dictionary-post-buffer,
dictionary-display-search-result, dictionary-display-word-entry,
dictionary-display-word-definition, dictionary-mark-reference,
dictionary-select-dictionary, dictionary-display-dictionarys,
dictionary-display-dictionary-line, dictionary-set-dictionary,
dictionary-special-dictionary, dictionary-display-more-info,
dictionary-select-strategy, dictionary-do-select-strategy,
dictionary-display-strategies, dictionary-display-strategy-line,
dictionary-set-strategy, dictionary-new-matching,
dictionary-do-matching, dictionary-display-only-match-result,
dictionary-display-match-result, dictionary-display-match-result,
dictionary-display-match-lines, dictionary-search,
dictionary-previous, dictionary-help, dictionary-match-words,
dictionary-mouse-popup-matching-words,
dictionary-popup-matching-words, dictionary-tooltip-mode,
dictionary-tooltip-mouse-event): Fix docstring
The following kind of changes were made:
- finish first line with a full stop (.)
- mention parameter in upper-case whenever possible (considering the
length constraints)
2020-12-14 10:55:35 +01:00
|
|
|
"Read the reply line from the server."
|
2020-10-05 06:56:59 +02:00
|
|
|
(let ((answer (dictionary-connection-read-crlf dictionary-connection)))
|
2020-10-05 06:50:25 +02:00
|
|
|
(if (string-match "\r?\n" answer)
|
|
|
|
(substring answer 0 (match-beginning 0))
|
|
|
|
answer)))
|
|
|
|
|
|
|
|
(defun dictionary-split-string (string)
|
Fix typos
* doc/lispref/display.texi (Size of Displayed Text):
* doc/lispref/windows.texi (Buffer Display Action Functions):
* etc/NEWS:
* etc/ORG-NEWS (Org-Attach has been refactored and extended):
* lisp/battery.el (display-battery-mode, battery--upower-subsribe):
* lisp/calendar/parse-time.el:
* lisp/dired-x.el:
* lisp/emacs-lisp/chart.el (chart-sequece, chart-bar-quickie):
* lisp/emacs-lisp/eldoc.el (eldoc-echo-area-use-multiline-p)
(eldoc-documentation-strategy):
* lisp/emacs-lisp/pcase.el (pcase--split-pred, pcase--u1):
* lisp/gnus/gnus-search.el (gnus-search-expandable-keys)
(gnus-search-parse-query, gnus-search-query-return-string)
(gnus-search-imap, gnus-search-imap-search-command)
(gnus-search-transform-expression):
* lisp/gnus/nnselect.el:
* lisp/isearch.el (isearch-lazy-count-format):
* lisp/mh-e/mh-show.el (mh-show-msg):
* lisp/net/dictionary-connection.el (dictionary-connection-open):
* lisp/net/dictionary.el (dictionary-default-popup-strategy)
(dictionary, dictionary-split-string, dictionary-do-select-dictionary)
(dictionary-display-dictionarys, dictionary-search)
(dictionary-tooltip-mode):
* lisp/net/eudcb-macos-contacts.el (eudc-macos-contacts-set-server):
* lisp/net/mailcap.el (mailcap-mime-data):
* lisp/net/tramp-smb.el (tramp-smb-maybe-open-connection):
* lisp/nxml/nxml-mode.el (nxml-mode):
* lisp/progmodes/cc-engine.el:
* lisp/progmodes/cperl-mode.el (cperl-mode)
(cperl-fontify-syntaxically):
* lisp/progmodes/flymake.el (flymake-diagnostic-functions):
* lisp/progmodes/verilog-mode.el (verilog--supressed-warnings)
(verilog-preprocess):
* lisp/simple.el (self-insert-uses-region-functions):
* lisp/textmodes/bibtex.el (bibtex-copy-summary-as-kill):
* lisp/textmodes/texnfo-upd.el (texinfo-insert-master-menu-list):
* src/dispnew.c:
* src/font.c (Ffont_get):
* src/indent.c (compute_motion):
* src/process.c (init_process_emacs):
* src/w32fns.c (deliver_wm_chars):
* test/lisp/jsonrpc-tests.el (deferred-action-complex-tests):
Fix typos in documentation, comments, and internal identifiers.
2021-02-18 16:41:36 +01:00
|
|
|
"Split STRING consisting of space-separated words into elements.
|
2020-10-05 06:50:25 +02:00
|
|
|
This function knows about the special meaning of quotes (\")"
|
|
|
|
(let ((list))
|
|
|
|
(while (and string (> (length string) 0))
|
|
|
|
(let ((search "\\(\\s-+\\)")
|
|
|
|
(start 0))
|
|
|
|
(if (= (aref string 0) ?\")
|
|
|
|
(setq search "\\(\"\\)\\s-*"
|
|
|
|
start 1))
|
|
|
|
(if (string-match search string start)
|
|
|
|
(progn
|
|
|
|
(setq list (cons (substring string start (- (match-end 1) 1)) list)
|
|
|
|
string (substring string (match-end 0))))
|
|
|
|
(setq list (cons string list)
|
|
|
|
string nil))))
|
|
|
|
(nreverse list)))
|
|
|
|
|
|
|
|
(defun dictionary-read-reply-and-split ()
|
Various doc fixes in dictionary.el
* lisp/net/dictionary.el (dictionary-set-server-var)
(dictionary-server, dictionary-port)
(dictionary-default-dictionary)
(dictionary-default-popup-strategy, dictionary-proxy-server)
(dictionary-proxy-port, dictionary-description-open-delimiter)
(dictionary-description-close-delimiter)
(dictionary-window-configuration, dictionary-selected-window)
(dictionary-position-stack, dictionary-data-stack)
(dictionary-positions, dictionary-current-data)
(dictionary-connection, dictionary-instances)
(dictionary-color-support, dictionary-word-history)
(dictionary-mode, dictionary, dictionary-check-connection)
(dictionary-mode-p, dictionary-send-command)
(dictionary-read-reply-and-split, dictionary-check-reply)
(dictionary-check-initial-reply, dictionary-store-state)
(dictionary-store-positions, dictionary-new-search)
(dictionary-new-search-internal, dictionary-do-search)
(dictionary-display-search-result)
(dictionary-display-word-definition)
(dictionary-special-dictionary, dictionary-set-strategy)
(dictionary-tooltip-dictionary, dictionary-switch-tooltip-mode)
(dictionary-tooltip-mode, global-dictionary-tooltip-mode): Doc fixes
to adhere to our conventions.
2021-02-07 15:53:46 +01:00
|
|
|
"Read the reply, split it into words and return it."
|
2020-10-05 06:50:25 +02:00
|
|
|
(let ((answer (make-symbol "reply-data"))
|
|
|
|
(reply (dictionary-read-reply)))
|
|
|
|
(let ((reply-list (dictionary-split-string reply)))
|
|
|
|
(put answer 'reply reply)
|
|
|
|
(put answer 'reply-list reply-list)
|
|
|
|
(put answer 'reply-code (string-to-number (car reply-list)))
|
|
|
|
answer)))
|
|
|
|
|
|
|
|
(defun dictionary-read-answer ()
|
A number of docstring fixes
* lisp/net/dictionary.el (dictionary-set-server-var, dictionary-mode,
dictionary, dictionary-new-buffer, dictionary-reply-code,
dictionary-reply, dictionary-reply-list, dictionary-open-server,
dictionary-check-connection, dictionary-mode-p, dictionary-close,
dictionary-read-reply, dictionary-split-string,
dictionary-read-reply-and-split, dictionary-read-answer,
dictionary-check-reply, dictionary-coding-system,
dictionary-decode-charset, dictionary-encode-charset,
dictionary-check-initial-reply, dictionary-store-state,
dictionary-restore-state, dictionary-new-search,
dictionary-new-search-internal, dictionary-do-search,
dictionary-pre-buffer, dictionary-post-buffer,
dictionary-display-search-result, dictionary-display-word-entry,
dictionary-display-word-definition, dictionary-mark-reference,
dictionary-select-dictionary, dictionary-display-dictionarys,
dictionary-display-dictionary-line, dictionary-set-dictionary,
dictionary-special-dictionary, dictionary-display-more-info,
dictionary-select-strategy, dictionary-do-select-strategy,
dictionary-display-strategies, dictionary-display-strategy-line,
dictionary-set-strategy, dictionary-new-matching,
dictionary-do-matching, dictionary-display-only-match-result,
dictionary-display-match-result, dictionary-display-match-result,
dictionary-display-match-lines, dictionary-search,
dictionary-previous, dictionary-help, dictionary-match-words,
dictionary-mouse-popup-matching-words,
dictionary-popup-matching-words, dictionary-tooltip-mode,
dictionary-tooltip-mouse-event): Fix docstring
The following kind of changes were made:
- finish first line with a full stop (.)
- mention parameter in upper-case whenever possible (considering the
length constraints)
2020-12-14 10:55:35 +01:00
|
|
|
"Read the complete answer.
|
|
|
|
The answer is delimited by a decimal point (.) on a line by itself."
|
2020-10-05 06:56:59 +02:00
|
|
|
(let ((answer (dictionary-connection-read-to-point dictionary-connection))
|
2020-10-05 06:50:25 +02:00
|
|
|
(start 0))
|
|
|
|
(while (string-match "\r\n" answer start)
|
|
|
|
(setq answer (replace-match "\n" t t answer))
|
|
|
|
(setq start (1- (match-end 0))))
|
|
|
|
(setq start 0)
|
|
|
|
(if (string-match "\n\\.\n.*" answer start)
|
|
|
|
(setq answer (replace-match "" t t answer)))
|
|
|
|
answer))
|
|
|
|
|
|
|
|
(defun dictionary-check-reply (reply code)
|
Various doc fixes in dictionary.el
* lisp/net/dictionary.el (dictionary-set-server-var)
(dictionary-server, dictionary-port)
(dictionary-default-dictionary)
(dictionary-default-popup-strategy, dictionary-proxy-server)
(dictionary-proxy-port, dictionary-description-open-delimiter)
(dictionary-description-close-delimiter)
(dictionary-window-configuration, dictionary-selected-window)
(dictionary-position-stack, dictionary-data-stack)
(dictionary-positions, dictionary-current-data)
(dictionary-connection, dictionary-instances)
(dictionary-color-support, dictionary-word-history)
(dictionary-mode, dictionary, dictionary-check-connection)
(dictionary-mode-p, dictionary-send-command)
(dictionary-read-reply-and-split, dictionary-check-reply)
(dictionary-check-initial-reply, dictionary-store-state)
(dictionary-store-positions, dictionary-new-search)
(dictionary-new-search-internal, dictionary-do-search)
(dictionary-display-search-result)
(dictionary-display-word-definition)
(dictionary-special-dictionary, dictionary-set-strategy)
(dictionary-tooltip-dictionary, dictionary-switch-tooltip-mode)
(dictionary-tooltip-mode, global-dictionary-tooltip-mode): Doc fixes
to adhere to our conventions.
2021-02-07 15:53:46 +01:00
|
|
|
"Extract the reply code from REPLY and check against CODE."
|
2020-10-05 06:50:25 +02:00
|
|
|
(let ((number (dictionary-reply-code reply)))
|
|
|
|
(and (numberp number)
|
|
|
|
(= number code))))
|
|
|
|
|
|
|
|
(defun dictionary-coding-system (dictionary)
|
A number of docstring fixes
* lisp/net/dictionary.el (dictionary-set-server-var, dictionary-mode,
dictionary, dictionary-new-buffer, dictionary-reply-code,
dictionary-reply, dictionary-reply-list, dictionary-open-server,
dictionary-check-connection, dictionary-mode-p, dictionary-close,
dictionary-read-reply, dictionary-split-string,
dictionary-read-reply-and-split, dictionary-read-answer,
dictionary-check-reply, dictionary-coding-system,
dictionary-decode-charset, dictionary-encode-charset,
dictionary-check-initial-reply, dictionary-store-state,
dictionary-restore-state, dictionary-new-search,
dictionary-new-search-internal, dictionary-do-search,
dictionary-pre-buffer, dictionary-post-buffer,
dictionary-display-search-result, dictionary-display-word-entry,
dictionary-display-word-definition, dictionary-mark-reference,
dictionary-select-dictionary, dictionary-display-dictionarys,
dictionary-display-dictionary-line, dictionary-set-dictionary,
dictionary-special-dictionary, dictionary-display-more-info,
dictionary-select-strategy, dictionary-do-select-strategy,
dictionary-display-strategies, dictionary-display-strategy-line,
dictionary-set-strategy, dictionary-new-matching,
dictionary-do-matching, dictionary-display-only-match-result,
dictionary-display-match-result, dictionary-display-match-result,
dictionary-display-match-lines, dictionary-search,
dictionary-previous, dictionary-help, dictionary-match-words,
dictionary-mouse-popup-matching-words,
dictionary-popup-matching-words, dictionary-tooltip-mode,
dictionary-tooltip-mouse-event): Fix docstring
The following kind of changes were made:
- finish first line with a full stop (.)
- mention parameter in upper-case whenever possible (considering the
length constraints)
2020-12-14 10:55:35 +01:00
|
|
|
"Select coding system to use for DICTIONARY."
|
2020-10-08 19:33:33 +02:00
|
|
|
(let ((coding-system
|
|
|
|
(or (cdr (assoc dictionary
|
|
|
|
dictionary-coding-systems-for-dictionaries))
|
|
|
|
'utf-8)))
|
|
|
|
(if (member coding-system (coding-system-list))
|
|
|
|
coding-system
|
|
|
|
nil)))
|
2020-10-05 06:50:25 +02:00
|
|
|
|
|
|
|
(defun dictionary-decode-charset (text dictionary)
|
A number of docstring fixes
* lisp/net/dictionary.el (dictionary-set-server-var, dictionary-mode,
dictionary, dictionary-new-buffer, dictionary-reply-code,
dictionary-reply, dictionary-reply-list, dictionary-open-server,
dictionary-check-connection, dictionary-mode-p, dictionary-close,
dictionary-read-reply, dictionary-split-string,
dictionary-read-reply-and-split, dictionary-read-answer,
dictionary-check-reply, dictionary-coding-system,
dictionary-decode-charset, dictionary-encode-charset,
dictionary-check-initial-reply, dictionary-store-state,
dictionary-restore-state, dictionary-new-search,
dictionary-new-search-internal, dictionary-do-search,
dictionary-pre-buffer, dictionary-post-buffer,
dictionary-display-search-result, dictionary-display-word-entry,
dictionary-display-word-definition, dictionary-mark-reference,
dictionary-select-dictionary, dictionary-display-dictionarys,
dictionary-display-dictionary-line, dictionary-set-dictionary,
dictionary-special-dictionary, dictionary-display-more-info,
dictionary-select-strategy, dictionary-do-select-strategy,
dictionary-display-strategies, dictionary-display-strategy-line,
dictionary-set-strategy, dictionary-new-matching,
dictionary-do-matching, dictionary-display-only-match-result,
dictionary-display-match-result, dictionary-display-match-result,
dictionary-display-match-lines, dictionary-search,
dictionary-previous, dictionary-help, dictionary-match-words,
dictionary-mouse-popup-matching-words,
dictionary-popup-matching-words, dictionary-tooltip-mode,
dictionary-tooltip-mouse-event): Fix docstring
The following kind of changes were made:
- finish first line with a full stop (.)
- mention parameter in upper-case whenever possible (considering the
length constraints)
2020-12-14 10:55:35 +01:00
|
|
|
"Convert TEXT from the charset configured for DICTIONARY."
|
2020-10-05 06:50:25 +02:00
|
|
|
(let ((coding-system (dictionary-coding-system dictionary)))
|
|
|
|
(if coding-system
|
|
|
|
(decode-coding-string text coding-system)
|
|
|
|
text)))
|
|
|
|
|
|
|
|
(defun dictionary-encode-charset (text dictionary)
|
A number of docstring fixes
* lisp/net/dictionary.el (dictionary-set-server-var, dictionary-mode,
dictionary, dictionary-new-buffer, dictionary-reply-code,
dictionary-reply, dictionary-reply-list, dictionary-open-server,
dictionary-check-connection, dictionary-mode-p, dictionary-close,
dictionary-read-reply, dictionary-split-string,
dictionary-read-reply-and-split, dictionary-read-answer,
dictionary-check-reply, dictionary-coding-system,
dictionary-decode-charset, dictionary-encode-charset,
dictionary-check-initial-reply, dictionary-store-state,
dictionary-restore-state, dictionary-new-search,
dictionary-new-search-internal, dictionary-do-search,
dictionary-pre-buffer, dictionary-post-buffer,
dictionary-display-search-result, dictionary-display-word-entry,
dictionary-display-word-definition, dictionary-mark-reference,
dictionary-select-dictionary, dictionary-display-dictionarys,
dictionary-display-dictionary-line, dictionary-set-dictionary,
dictionary-special-dictionary, dictionary-display-more-info,
dictionary-select-strategy, dictionary-do-select-strategy,
dictionary-display-strategies, dictionary-display-strategy-line,
dictionary-set-strategy, dictionary-new-matching,
dictionary-do-matching, dictionary-display-only-match-result,
dictionary-display-match-result, dictionary-display-match-result,
dictionary-display-match-lines, dictionary-search,
dictionary-previous, dictionary-help, dictionary-match-words,
dictionary-mouse-popup-matching-words,
dictionary-popup-matching-words, dictionary-tooltip-mode,
dictionary-tooltip-mouse-event): Fix docstring
The following kind of changes were made:
- finish first line with a full stop (.)
- mention parameter in upper-case whenever possible (considering the
length constraints)
2020-12-14 10:55:35 +01:00
|
|
|
"Convert TEXT to the charset defined for DICTIONARY."
|
2020-10-05 06:50:25 +02:00
|
|
|
(let ((coding-system (dictionary-coding-system dictionary)))
|
|
|
|
(if coding-system
|
|
|
|
(encode-coding-string text coding-system)
|
|
|
|
text)))
|
|
|
|
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
;; Communication functions
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
|
|
|
|
(defun dictionary-check-initial-reply ()
|
Various doc fixes in dictionary.el
* lisp/net/dictionary.el (dictionary-set-server-var)
(dictionary-server, dictionary-port)
(dictionary-default-dictionary)
(dictionary-default-popup-strategy, dictionary-proxy-server)
(dictionary-proxy-port, dictionary-description-open-delimiter)
(dictionary-description-close-delimiter)
(dictionary-window-configuration, dictionary-selected-window)
(dictionary-position-stack, dictionary-data-stack)
(dictionary-positions, dictionary-current-data)
(dictionary-connection, dictionary-instances)
(dictionary-color-support, dictionary-word-history)
(dictionary-mode, dictionary, dictionary-check-connection)
(dictionary-mode-p, dictionary-send-command)
(dictionary-read-reply-and-split, dictionary-check-reply)
(dictionary-check-initial-reply, dictionary-store-state)
(dictionary-store-positions, dictionary-new-search)
(dictionary-new-search-internal, dictionary-do-search)
(dictionary-display-search-result)
(dictionary-display-word-definition)
(dictionary-special-dictionary, dictionary-set-strategy)
(dictionary-tooltip-dictionary, dictionary-switch-tooltip-mode)
(dictionary-tooltip-mode, global-dictionary-tooltip-mode): Doc fixes
to adhere to our conventions.
2021-02-07 15:53:46 +01:00
|
|
|
"Read the first reply from server and check it."
|
2020-10-05 06:50:25 +02:00
|
|
|
(let ((reply (dictionary-read-reply-and-split)))
|
|
|
|
(unless (dictionary-check-reply reply 220)
|
2020-10-05 06:56:59 +02:00
|
|
|
(dictionary-connection-close dictionary-connection)
|
2020-10-05 06:50:25 +02:00
|
|
|
(error "Server returned: %s" (dictionary-reply reply)))))
|
|
|
|
|
|
|
|
;; Store the current state
|
|
|
|
(defun dictionary-store-state (function data)
|
Various doc fixes in dictionary.el
* lisp/net/dictionary.el (dictionary-set-server-var)
(dictionary-server, dictionary-port)
(dictionary-default-dictionary)
(dictionary-default-popup-strategy, dictionary-proxy-server)
(dictionary-proxy-port, dictionary-description-open-delimiter)
(dictionary-description-close-delimiter)
(dictionary-window-configuration, dictionary-selected-window)
(dictionary-position-stack, dictionary-data-stack)
(dictionary-positions, dictionary-current-data)
(dictionary-connection, dictionary-instances)
(dictionary-color-support, dictionary-word-history)
(dictionary-mode, dictionary, dictionary-check-connection)
(dictionary-mode-p, dictionary-send-command)
(dictionary-read-reply-and-split, dictionary-check-reply)
(dictionary-check-initial-reply, dictionary-store-state)
(dictionary-store-positions, dictionary-new-search)
(dictionary-new-search-internal, dictionary-do-search)
(dictionary-display-search-result)
(dictionary-display-word-definition)
(dictionary-special-dictionary, dictionary-set-strategy)
(dictionary-tooltip-dictionary, dictionary-switch-tooltip-mode)
(dictionary-tooltip-mode, global-dictionary-tooltip-mode): Doc fixes
to adhere to our conventions.
2021-02-07 15:53:46 +01:00
|
|
|
"Store the current state of operation for later restore.
|
|
|
|
The current state consist of a tuple of FUNCTION and DATA.
|
|
|
|
This is basically an implementation of a history to return to a
|
A number of docstring fixes
* lisp/net/dictionary.el (dictionary-set-server-var, dictionary-mode,
dictionary, dictionary-new-buffer, dictionary-reply-code,
dictionary-reply, dictionary-reply-list, dictionary-open-server,
dictionary-check-connection, dictionary-mode-p, dictionary-close,
dictionary-read-reply, dictionary-split-string,
dictionary-read-reply-and-split, dictionary-read-answer,
dictionary-check-reply, dictionary-coding-system,
dictionary-decode-charset, dictionary-encode-charset,
dictionary-check-initial-reply, dictionary-store-state,
dictionary-restore-state, dictionary-new-search,
dictionary-new-search-internal, dictionary-do-search,
dictionary-pre-buffer, dictionary-post-buffer,
dictionary-display-search-result, dictionary-display-word-entry,
dictionary-display-word-definition, dictionary-mark-reference,
dictionary-select-dictionary, dictionary-display-dictionarys,
dictionary-display-dictionary-line, dictionary-set-dictionary,
dictionary-special-dictionary, dictionary-display-more-info,
dictionary-select-strategy, dictionary-do-select-strategy,
dictionary-display-strategies, dictionary-display-strategy-line,
dictionary-set-strategy, dictionary-new-matching,
dictionary-do-matching, dictionary-display-only-match-result,
dictionary-display-match-result, dictionary-display-match-result,
dictionary-display-match-lines, dictionary-search,
dictionary-previous, dictionary-help, dictionary-match-words,
dictionary-mouse-popup-matching-words,
dictionary-popup-matching-words, dictionary-tooltip-mode,
dictionary-tooltip-mouse-event): Fix docstring
The following kind of changes were made:
- finish first line with a full stop (.)
- mention parameter in upper-case whenever possible (considering the
length constraints)
2020-12-14 10:55:35 +01:00
|
|
|
previous state."
|
2020-10-05 06:50:25 +02:00
|
|
|
(if dictionary-current-data
|
|
|
|
(progn
|
|
|
|
(push dictionary-current-data dictionary-data-stack)
|
|
|
|
(unless dictionary-positions
|
|
|
|
(error "dictionary-store-state called before dictionary-store-positions"))
|
|
|
|
(push dictionary-positions dictionary-position-stack)))
|
|
|
|
(setq dictionary-current-data
|
|
|
|
(cons function data)))
|
|
|
|
|
|
|
|
(defun dictionary-store-positions ()
|
Various doc fixes in dictionary.el
* lisp/net/dictionary.el (dictionary-set-server-var)
(dictionary-server, dictionary-port)
(dictionary-default-dictionary)
(dictionary-default-popup-strategy, dictionary-proxy-server)
(dictionary-proxy-port, dictionary-description-open-delimiter)
(dictionary-description-close-delimiter)
(dictionary-window-configuration, dictionary-selected-window)
(dictionary-position-stack, dictionary-data-stack)
(dictionary-positions, dictionary-current-data)
(dictionary-connection, dictionary-instances)
(dictionary-color-support, dictionary-word-history)
(dictionary-mode, dictionary, dictionary-check-connection)
(dictionary-mode-p, dictionary-send-command)
(dictionary-read-reply-and-split, dictionary-check-reply)
(dictionary-check-initial-reply, dictionary-store-state)
(dictionary-store-positions, dictionary-new-search)
(dictionary-new-search-internal, dictionary-do-search)
(dictionary-display-search-result)
(dictionary-display-word-definition)
(dictionary-special-dictionary, dictionary-set-strategy)
(dictionary-tooltip-dictionary, dictionary-switch-tooltip-mode)
(dictionary-tooltip-mode, global-dictionary-tooltip-mode): Doc fixes
to adhere to our conventions.
2021-02-07 15:53:46 +01:00
|
|
|
"Store the current positions for later restore."
|
2020-10-05 06:50:25 +02:00
|
|
|
|
|
|
|
(setq dictionary-positions (cons (point) (window-start))))
|
|
|
|
|
|
|
|
;; Restore the previous state
|
2021-03-08 10:11:22 -05:00
|
|
|
(defun dictionary-restore-state (&rest _ignored)
|
A number of docstring fixes
* lisp/net/dictionary.el (dictionary-set-server-var, dictionary-mode,
dictionary, dictionary-new-buffer, dictionary-reply-code,
dictionary-reply, dictionary-reply-list, dictionary-open-server,
dictionary-check-connection, dictionary-mode-p, dictionary-close,
dictionary-read-reply, dictionary-split-string,
dictionary-read-reply-and-split, dictionary-read-answer,
dictionary-check-reply, dictionary-coding-system,
dictionary-decode-charset, dictionary-encode-charset,
dictionary-check-initial-reply, dictionary-store-state,
dictionary-restore-state, dictionary-new-search,
dictionary-new-search-internal, dictionary-do-search,
dictionary-pre-buffer, dictionary-post-buffer,
dictionary-display-search-result, dictionary-display-word-entry,
dictionary-display-word-definition, dictionary-mark-reference,
dictionary-select-dictionary, dictionary-display-dictionarys,
dictionary-display-dictionary-line, dictionary-set-dictionary,
dictionary-special-dictionary, dictionary-display-more-info,
dictionary-select-strategy, dictionary-do-select-strategy,
dictionary-display-strategies, dictionary-display-strategy-line,
dictionary-set-strategy, dictionary-new-matching,
dictionary-do-matching, dictionary-display-only-match-result,
dictionary-display-match-result, dictionary-display-match-result,
dictionary-display-match-lines, dictionary-search,
dictionary-previous, dictionary-help, dictionary-match-words,
dictionary-mouse-popup-matching-words,
dictionary-popup-matching-words, dictionary-tooltip-mode,
dictionary-tooltip-mouse-event): Fix docstring
The following kind of changes were made:
- finish first line with a full stop (.)
- mention parameter in upper-case whenever possible (considering the
length constraints)
2020-12-14 10:55:35 +01:00
|
|
|
"Restore the state just before the last operation."
|
2020-10-05 06:50:25 +02:00
|
|
|
(let ((position (pop dictionary-position-stack))
|
|
|
|
(data (pop dictionary-data-stack)))
|
|
|
|
(unless position
|
|
|
|
(error "Already at begin of history"))
|
|
|
|
(apply (car data) (cdr data))
|
|
|
|
(set-window-start (selected-window) (cdr position))
|
|
|
|
(goto-char (car position))
|
|
|
|
(setq dictionary-current-data data)))
|
|
|
|
|
|
|
|
;; The normal search
|
|
|
|
|
|
|
|
(defun dictionary-new-search (args &optional all)
|
Various doc fixes in dictionary.el
* lisp/net/dictionary.el (dictionary-set-server-var)
(dictionary-server, dictionary-port)
(dictionary-default-dictionary)
(dictionary-default-popup-strategy, dictionary-proxy-server)
(dictionary-proxy-port, dictionary-description-open-delimiter)
(dictionary-description-close-delimiter)
(dictionary-window-configuration, dictionary-selected-window)
(dictionary-position-stack, dictionary-data-stack)
(dictionary-positions, dictionary-current-data)
(dictionary-connection, dictionary-instances)
(dictionary-color-support, dictionary-word-history)
(dictionary-mode, dictionary, dictionary-check-connection)
(dictionary-mode-p, dictionary-send-command)
(dictionary-read-reply-and-split, dictionary-check-reply)
(dictionary-check-initial-reply, dictionary-store-state)
(dictionary-store-positions, dictionary-new-search)
(dictionary-new-search-internal, dictionary-do-search)
(dictionary-display-search-result)
(dictionary-display-word-definition)
(dictionary-special-dictionary, dictionary-set-strategy)
(dictionary-tooltip-dictionary, dictionary-switch-tooltip-mode)
(dictionary-tooltip-mode, global-dictionary-tooltip-mode): Doc fixes
to adhere to our conventions.
2021-02-07 15:53:46 +01:00
|
|
|
"Save the current state and start a new search based on ARGS.
|
A number of docstring fixes
* lisp/net/dictionary.el (dictionary-set-server-var, dictionary-mode,
dictionary, dictionary-new-buffer, dictionary-reply-code,
dictionary-reply, dictionary-reply-list, dictionary-open-server,
dictionary-check-connection, dictionary-mode-p, dictionary-close,
dictionary-read-reply, dictionary-split-string,
dictionary-read-reply-and-split, dictionary-read-answer,
dictionary-check-reply, dictionary-coding-system,
dictionary-decode-charset, dictionary-encode-charset,
dictionary-check-initial-reply, dictionary-store-state,
dictionary-restore-state, dictionary-new-search,
dictionary-new-search-internal, dictionary-do-search,
dictionary-pre-buffer, dictionary-post-buffer,
dictionary-display-search-result, dictionary-display-word-entry,
dictionary-display-word-definition, dictionary-mark-reference,
dictionary-select-dictionary, dictionary-display-dictionarys,
dictionary-display-dictionary-line, dictionary-set-dictionary,
dictionary-special-dictionary, dictionary-display-more-info,
dictionary-select-strategy, dictionary-do-select-strategy,
dictionary-display-strategies, dictionary-display-strategy-line,
dictionary-set-strategy, dictionary-new-matching,
dictionary-do-matching, dictionary-display-only-match-result,
dictionary-display-match-result, dictionary-display-match-result,
dictionary-display-match-lines, dictionary-search,
dictionary-previous, dictionary-help, dictionary-match-words,
dictionary-mouse-popup-matching-words,
dictionary-popup-matching-words, dictionary-tooltip-mode,
dictionary-tooltip-mouse-event): Fix docstring
The following kind of changes were made:
- finish first line with a full stop (.)
- mention parameter in upper-case whenever possible (considering the
length constraints)
2020-12-14 10:55:35 +01:00
|
|
|
The parameter ARGS is a cons cell where car is the word to search
|
|
|
|
and cdr is the dictionary where to search the word in."
|
2020-10-05 06:50:25 +02:00
|
|
|
(dictionary-store-positions)
|
|
|
|
(let ((word (car args))
|
|
|
|
(dictionary (cdr args)))
|
|
|
|
|
|
|
|
(if all
|
|
|
|
(setq dictionary dictionary-default-dictionary))
|
|
|
|
(dictionary-ensure-buffer)
|
|
|
|
(dictionary-new-search-internal word dictionary 'dictionary-display-search-result)
|
|
|
|
(dictionary-store-state 'dictionary-new-search-internal
|
|
|
|
(list word dictionary 'dictionary-display-search-result))))
|
|
|
|
|
|
|
|
(defun dictionary-new-search-internal (word dictionary function)
|
Various doc fixes in dictionary.el
* lisp/net/dictionary.el (dictionary-set-server-var)
(dictionary-server, dictionary-port)
(dictionary-default-dictionary)
(dictionary-default-popup-strategy, dictionary-proxy-server)
(dictionary-proxy-port, dictionary-description-open-delimiter)
(dictionary-description-close-delimiter)
(dictionary-window-configuration, dictionary-selected-window)
(dictionary-position-stack, dictionary-data-stack)
(dictionary-positions, dictionary-current-data)
(dictionary-connection, dictionary-instances)
(dictionary-color-support, dictionary-word-history)
(dictionary-mode, dictionary, dictionary-check-connection)
(dictionary-mode-p, dictionary-send-command)
(dictionary-read-reply-and-split, dictionary-check-reply)
(dictionary-check-initial-reply, dictionary-store-state)
(dictionary-store-positions, dictionary-new-search)
(dictionary-new-search-internal, dictionary-do-search)
(dictionary-display-search-result)
(dictionary-display-word-definition)
(dictionary-special-dictionary, dictionary-set-strategy)
(dictionary-tooltip-dictionary, dictionary-switch-tooltip-mode)
(dictionary-tooltip-mode, global-dictionary-tooltip-mode): Doc fixes
to adhere to our conventions.
2021-02-07 15:53:46 +01:00
|
|
|
"Start a new search for WORD in DICTIONARY after preparing the buffer.
|
|
|
|
FUNCTION is the callback which is called for each search result."
|
2020-10-05 06:50:25 +02:00
|
|
|
(dictionary-pre-buffer)
|
|
|
|
(dictionary-do-search word dictionary function))
|
|
|
|
|
|
|
|
(defun dictionary-do-search (word dictionary function &optional nomatching)
|
Various doc fixes in dictionary.el
* lisp/net/dictionary.el (dictionary-set-server-var)
(dictionary-server, dictionary-port)
(dictionary-default-dictionary)
(dictionary-default-popup-strategy, dictionary-proxy-server)
(dictionary-proxy-port, dictionary-description-open-delimiter)
(dictionary-description-close-delimiter)
(dictionary-window-configuration, dictionary-selected-window)
(dictionary-position-stack, dictionary-data-stack)
(dictionary-positions, dictionary-current-data)
(dictionary-connection, dictionary-instances)
(dictionary-color-support, dictionary-word-history)
(dictionary-mode, dictionary, dictionary-check-connection)
(dictionary-mode-p, dictionary-send-command)
(dictionary-read-reply-and-split, dictionary-check-reply)
(dictionary-check-initial-reply, dictionary-store-state)
(dictionary-store-positions, dictionary-new-search)
(dictionary-new-search-internal, dictionary-do-search)
(dictionary-display-search-result)
(dictionary-display-word-definition)
(dictionary-special-dictionary, dictionary-set-strategy)
(dictionary-tooltip-dictionary, dictionary-switch-tooltip-mode)
(dictionary-tooltip-mode, global-dictionary-tooltip-mode): Doc fixes
to adhere to our conventions.
2021-02-07 15:53:46 +01:00
|
|
|
"Search for WORD in DICTIONARY and call FUNCTION for each result.
|
|
|
|
Optional argument NOMATCHING controls whether to suppress the display
|
A number of docstring fixes
* lisp/net/dictionary.el (dictionary-set-server-var, dictionary-mode,
dictionary, dictionary-new-buffer, dictionary-reply-code,
dictionary-reply, dictionary-reply-list, dictionary-open-server,
dictionary-check-connection, dictionary-mode-p, dictionary-close,
dictionary-read-reply, dictionary-split-string,
dictionary-read-reply-and-split, dictionary-read-answer,
dictionary-check-reply, dictionary-coding-system,
dictionary-decode-charset, dictionary-encode-charset,
dictionary-check-initial-reply, dictionary-store-state,
dictionary-restore-state, dictionary-new-search,
dictionary-new-search-internal, dictionary-do-search,
dictionary-pre-buffer, dictionary-post-buffer,
dictionary-display-search-result, dictionary-display-word-entry,
dictionary-display-word-definition, dictionary-mark-reference,
dictionary-select-dictionary, dictionary-display-dictionarys,
dictionary-display-dictionary-line, dictionary-set-dictionary,
dictionary-special-dictionary, dictionary-display-more-info,
dictionary-select-strategy, dictionary-do-select-strategy,
dictionary-display-strategies, dictionary-display-strategy-line,
dictionary-set-strategy, dictionary-new-matching,
dictionary-do-matching, dictionary-display-only-match-result,
dictionary-display-match-result, dictionary-display-match-result,
dictionary-display-match-lines, dictionary-search,
dictionary-previous, dictionary-help, dictionary-match-words,
dictionary-mouse-popup-matching-words,
dictionary-popup-matching-words, dictionary-tooltip-mode,
dictionary-tooltip-mouse-event): Fix docstring
The following kind of changes were made:
- finish first line with a full stop (.)
- mention parameter in upper-case whenever possible (considering the
length constraints)
2020-12-14 10:55:35 +01:00
|
|
|
of matching words."
|
2020-10-05 06:50:25 +02:00
|
|
|
|
|
|
|
(message "Searching for %s in %s" word dictionary)
|
|
|
|
(dictionary-send-command (concat "define "
|
|
|
|
(dictionary-encode-charset dictionary "")
|
|
|
|
" \""
|
|
|
|
(dictionary-encode-charset word dictionary)
|
|
|
|
"\""))
|
|
|
|
|
|
|
|
(message nil)
|
|
|
|
(let ((reply (dictionary-read-reply-and-split)))
|
|
|
|
(if (dictionary-check-reply reply 552)
|
|
|
|
(progn
|
|
|
|
(unless nomatching
|
2021-03-18 08:43:22 +01:00
|
|
|
(insert "Word not found")
|
|
|
|
(dictionary-do-matching
|
|
|
|
word
|
|
|
|
dictionary
|
|
|
|
"."
|
|
|
|
(lambda (reply)
|
|
|
|
(insert ", maybe you are looking for one of these words\n\n")
|
|
|
|
(dictionary-display-only-match-result reply)))
|
2020-10-05 06:50:25 +02:00
|
|
|
(dictionary-post-buffer)))
|
|
|
|
(if (dictionary-check-reply reply 550)
|
Various doc fixes in dictionary.el
* lisp/net/dictionary.el (dictionary-set-server-var)
(dictionary-server, dictionary-port)
(dictionary-default-dictionary)
(dictionary-default-popup-strategy, dictionary-proxy-server)
(dictionary-proxy-port, dictionary-description-open-delimiter)
(dictionary-description-close-delimiter)
(dictionary-window-configuration, dictionary-selected-window)
(dictionary-position-stack, dictionary-data-stack)
(dictionary-positions, dictionary-current-data)
(dictionary-connection, dictionary-instances)
(dictionary-color-support, dictionary-word-history)
(dictionary-mode, dictionary, dictionary-check-connection)
(dictionary-mode-p, dictionary-send-command)
(dictionary-read-reply-and-split, dictionary-check-reply)
(dictionary-check-initial-reply, dictionary-store-state)
(dictionary-store-positions, dictionary-new-search)
(dictionary-new-search-internal, dictionary-do-search)
(dictionary-display-search-result)
(dictionary-display-word-definition)
(dictionary-special-dictionary, dictionary-set-strategy)
(dictionary-tooltip-dictionary, dictionary-switch-tooltip-mode)
(dictionary-tooltip-mode, global-dictionary-tooltip-mode): Doc fixes
to adhere to our conventions.
2021-02-07 15:53:46 +01:00
|
|
|
(error "Dictionary \"%s\" is unknown, please select an existing one"
|
2020-10-05 06:50:25 +02:00
|
|
|
dictionary)
|
|
|
|
(unless (dictionary-check-reply reply 150)
|
|
|
|
(error "Unknown server answer: %s" (dictionary-reply reply)))
|
|
|
|
(funcall function reply)))))
|
|
|
|
|
2020-10-09 05:00:02 +02:00
|
|
|
(define-button-type 'dictionary-link
|
|
|
|
'face 'dictionary-reference-face
|
2020-10-09 06:04:35 +02:00
|
|
|
'action (lambda (button)
|
|
|
|
(let ((func (button-get button 'callback))
|
|
|
|
(data (button-get button 'data))
|
|
|
|
(list-data (button-get button 'list-data)))
|
|
|
|
(if list-data
|
|
|
|
(apply func list-data)
|
|
|
|
(funcall func data)))))
|
2020-10-09 05:00:02 +02:00
|
|
|
|
|
|
|
(define-button-type 'dictionary-button
|
|
|
|
:supertype 'dictionary-link
|
|
|
|
'face 'dictionary-button-face)
|
|
|
|
|
2020-10-05 06:50:25 +02:00
|
|
|
(defun dictionary-pre-buffer ()
|
A number of docstring fixes
* lisp/net/dictionary.el (dictionary-set-server-var, dictionary-mode,
dictionary, dictionary-new-buffer, dictionary-reply-code,
dictionary-reply, dictionary-reply-list, dictionary-open-server,
dictionary-check-connection, dictionary-mode-p, dictionary-close,
dictionary-read-reply, dictionary-split-string,
dictionary-read-reply-and-split, dictionary-read-answer,
dictionary-check-reply, dictionary-coding-system,
dictionary-decode-charset, dictionary-encode-charset,
dictionary-check-initial-reply, dictionary-store-state,
dictionary-restore-state, dictionary-new-search,
dictionary-new-search-internal, dictionary-do-search,
dictionary-pre-buffer, dictionary-post-buffer,
dictionary-display-search-result, dictionary-display-word-entry,
dictionary-display-word-definition, dictionary-mark-reference,
dictionary-select-dictionary, dictionary-display-dictionarys,
dictionary-display-dictionary-line, dictionary-set-dictionary,
dictionary-special-dictionary, dictionary-display-more-info,
dictionary-select-strategy, dictionary-do-select-strategy,
dictionary-display-strategies, dictionary-display-strategy-line,
dictionary-set-strategy, dictionary-new-matching,
dictionary-do-matching, dictionary-display-only-match-result,
dictionary-display-match-result, dictionary-display-match-result,
dictionary-display-match-lines, dictionary-search,
dictionary-previous, dictionary-help, dictionary-match-words,
dictionary-mouse-popup-matching-words,
dictionary-popup-matching-words, dictionary-tooltip-mode,
dictionary-tooltip-mouse-event): Fix docstring
The following kind of changes were made:
- finish first line with a full stop (.)
- mention parameter in upper-case whenever possible (considering the
length constraints)
2020-12-14 10:55:35 +01:00
|
|
|
"These commands are executed at the begin of a new buffer."
|
2020-10-05 06:50:25 +02:00
|
|
|
(setq buffer-read-only nil)
|
|
|
|
(erase-buffer)
|
|
|
|
(if dictionary-create-buttons
|
|
|
|
(progn
|
2020-10-09 05:00:02 +02:00
|
|
|
(insert-button "[Back]" :type 'dictionary-button
|
|
|
|
'callback 'dictionary-restore-state
|
2022-07-10 17:09:18 +02:00
|
|
|
'help-echo "Mouse-2 to go backwards in history")
|
2020-10-05 06:50:25 +02:00
|
|
|
(insert " ")
|
2020-12-14 11:44:12 +01:00
|
|
|
(insert-button "[Search definition]" :type 'dictionary-button
|
2020-10-09 05:00:02 +02:00
|
|
|
'callback 'dictionary-search
|
2022-07-10 17:09:18 +02:00
|
|
|
'help-echo "Mouse-2 to look up a new word")
|
2020-10-05 06:50:25 +02:00
|
|
|
(insert " ")
|
|
|
|
|
2020-10-09 05:00:02 +02:00
|
|
|
(insert-button "[Matching words]" :type 'dictionary-button
|
|
|
|
'callback 'dictionary-match-words
|
2022-07-10 17:09:18 +02:00
|
|
|
'help-echo "Mouse-2 to find matches for a pattern")
|
2020-10-05 06:50:25 +02:00
|
|
|
(insert " ")
|
|
|
|
|
2020-10-09 05:00:02 +02:00
|
|
|
(insert-button "[Quit]" :type 'dictionary-button
|
|
|
|
'callback 'dictionary-close
|
2022-07-10 17:09:18 +02:00
|
|
|
'help-echo "Mouse-2 to close this window")
|
2020-10-05 06:50:25 +02:00
|
|
|
|
|
|
|
(insert "\n ")
|
|
|
|
|
2020-12-14 11:44:12 +01:00
|
|
|
(insert-button "[Select dictionary]" :type 'dictionary-button
|
2020-10-09 05:00:02 +02:00
|
|
|
'callback 'dictionary-select-dictionary
|
2022-07-10 17:09:18 +02:00
|
|
|
'help-echo "Mouse-2 to select dictionary for future searches")
|
2020-10-05 06:50:25 +02:00
|
|
|
(insert " ")
|
2020-12-14 11:44:12 +01:00
|
|
|
(insert-button "[Select match strategy]" :type 'dictionary-button
|
2020-10-09 05:00:02 +02:00
|
|
|
'callback 'dictionary-select-strategy
|
2022-07-10 17:09:18 +02:00
|
|
|
'help-echo "Mouse-2 to select matching algorithm")
|
2020-10-05 06:50:25 +02:00
|
|
|
(insert "\n\n")))
|
|
|
|
(setq dictionary-marker (point-marker)))
|
|
|
|
|
|
|
|
(defun dictionary-post-buffer ()
|
A number of docstring fixes
* lisp/net/dictionary.el (dictionary-set-server-var, dictionary-mode,
dictionary, dictionary-new-buffer, dictionary-reply-code,
dictionary-reply, dictionary-reply-list, dictionary-open-server,
dictionary-check-connection, dictionary-mode-p, dictionary-close,
dictionary-read-reply, dictionary-split-string,
dictionary-read-reply-and-split, dictionary-read-answer,
dictionary-check-reply, dictionary-coding-system,
dictionary-decode-charset, dictionary-encode-charset,
dictionary-check-initial-reply, dictionary-store-state,
dictionary-restore-state, dictionary-new-search,
dictionary-new-search-internal, dictionary-do-search,
dictionary-pre-buffer, dictionary-post-buffer,
dictionary-display-search-result, dictionary-display-word-entry,
dictionary-display-word-definition, dictionary-mark-reference,
dictionary-select-dictionary, dictionary-display-dictionarys,
dictionary-display-dictionary-line, dictionary-set-dictionary,
dictionary-special-dictionary, dictionary-display-more-info,
dictionary-select-strategy, dictionary-do-select-strategy,
dictionary-display-strategies, dictionary-display-strategy-line,
dictionary-set-strategy, dictionary-new-matching,
dictionary-do-matching, dictionary-display-only-match-result,
dictionary-display-match-result, dictionary-display-match-result,
dictionary-display-match-lines, dictionary-search,
dictionary-previous, dictionary-help, dictionary-match-words,
dictionary-mouse-popup-matching-words,
dictionary-popup-matching-words, dictionary-tooltip-mode,
dictionary-tooltip-mouse-event): Fix docstring
The following kind of changes were made:
- finish first line with a full stop (.)
- mention parameter in upper-case whenever possible (considering the
length constraints)
2020-12-14 10:55:35 +01:00
|
|
|
"These commands are executed at the end of a new buffer."
|
2020-10-05 06:50:25 +02:00
|
|
|
(goto-char dictionary-marker)
|
|
|
|
|
|
|
|
(set-buffer-modified-p nil)
|
2021-02-09 20:29:54 +02:00
|
|
|
(setq buffer-read-only t)
|
|
|
|
(run-hooks 'dictionary-post-buffer-hook))
|
2020-10-05 06:50:25 +02:00
|
|
|
|
|
|
|
(defun dictionary-display-search-result (reply)
|
Various doc fixes in dictionary.el
* lisp/net/dictionary.el (dictionary-set-server-var)
(dictionary-server, dictionary-port)
(dictionary-default-dictionary)
(dictionary-default-popup-strategy, dictionary-proxy-server)
(dictionary-proxy-port, dictionary-description-open-delimiter)
(dictionary-description-close-delimiter)
(dictionary-window-configuration, dictionary-selected-window)
(dictionary-position-stack, dictionary-data-stack)
(dictionary-positions, dictionary-current-data)
(dictionary-connection, dictionary-instances)
(dictionary-color-support, dictionary-word-history)
(dictionary-mode, dictionary, dictionary-check-connection)
(dictionary-mode-p, dictionary-send-command)
(dictionary-read-reply-and-split, dictionary-check-reply)
(dictionary-check-initial-reply, dictionary-store-state)
(dictionary-store-positions, dictionary-new-search)
(dictionary-new-search-internal, dictionary-do-search)
(dictionary-display-search-result)
(dictionary-display-word-definition)
(dictionary-special-dictionary, dictionary-set-strategy)
(dictionary-tooltip-dictionary, dictionary-switch-tooltip-mode)
(dictionary-tooltip-mode, global-dictionary-tooltip-mode): Doc fixes
to adhere to our conventions.
2021-02-07 15:53:46 +01:00
|
|
|
"Start displaying the result in REPLY."
|
2020-10-05 06:50:25 +02:00
|
|
|
|
|
|
|
(let ((number (nth 1 (dictionary-reply-list reply))))
|
|
|
|
(insert number (if (equal number "1")
|
|
|
|
" definition"
|
|
|
|
" definitions")
|
|
|
|
" found\n\n")
|
|
|
|
(setq reply (dictionary-read-reply-and-split))
|
|
|
|
(while (dictionary-check-reply reply 151)
|
|
|
|
(let* ((reply-list (dictionary-reply-list reply))
|
|
|
|
(dictionary (nth 2 reply-list))
|
|
|
|
(description (nth 3 reply-list))
|
|
|
|
(word (nth 1 reply-list)))
|
2020-11-19 21:39:10 +01:00
|
|
|
(dictionary-display-word-entry dictionary description)
|
2020-10-05 06:50:25 +02:00
|
|
|
(setq reply (dictionary-read-answer))
|
|
|
|
(dictionary-display-word-definition reply word dictionary)
|
|
|
|
(setq reply (dictionary-read-reply-and-split))))
|
|
|
|
(dictionary-post-buffer)))
|
|
|
|
|
2020-11-19 21:39:10 +01:00
|
|
|
(defun dictionary-display-word-entry (dictionary description)
|
A number of docstring fixes
* lisp/net/dictionary.el (dictionary-set-server-var, dictionary-mode,
dictionary, dictionary-new-buffer, dictionary-reply-code,
dictionary-reply, dictionary-reply-list, dictionary-open-server,
dictionary-check-connection, dictionary-mode-p, dictionary-close,
dictionary-read-reply, dictionary-split-string,
dictionary-read-reply-and-split, dictionary-read-answer,
dictionary-check-reply, dictionary-coding-system,
dictionary-decode-charset, dictionary-encode-charset,
dictionary-check-initial-reply, dictionary-store-state,
dictionary-restore-state, dictionary-new-search,
dictionary-new-search-internal, dictionary-do-search,
dictionary-pre-buffer, dictionary-post-buffer,
dictionary-display-search-result, dictionary-display-word-entry,
dictionary-display-word-definition, dictionary-mark-reference,
dictionary-select-dictionary, dictionary-display-dictionarys,
dictionary-display-dictionary-line, dictionary-set-dictionary,
dictionary-special-dictionary, dictionary-display-more-info,
dictionary-select-strategy, dictionary-do-select-strategy,
dictionary-display-strategies, dictionary-display-strategy-line,
dictionary-set-strategy, dictionary-new-matching,
dictionary-do-matching, dictionary-display-only-match-result,
dictionary-display-match-result, dictionary-display-match-result,
dictionary-display-match-lines, dictionary-search,
dictionary-previous, dictionary-help, dictionary-match-words,
dictionary-mouse-popup-matching-words,
dictionary-popup-matching-words, dictionary-tooltip-mode,
dictionary-tooltip-mouse-event): Fix docstring
The following kind of changes were made:
- finish first line with a full stop (.)
- mention parameter in upper-case whenever possible (considering the
length constraints)
2020-12-14 10:55:35 +01:00
|
|
|
"Insert an explanation for DESCRIPTION from DICTIONARY.
|
|
|
|
The DICTIONARY is only used for decoding the bytes to display the DESCRIPTION."
|
2020-10-05 06:50:25 +02:00
|
|
|
(let ((start (point)))
|
|
|
|
(insert "From "
|
|
|
|
dictionary-description-open-delimiter
|
|
|
|
(dictionary-decode-charset description dictionary)
|
|
|
|
dictionary-description-close-delimiter
|
2020-11-08 16:06:02 +01:00
|
|
|
" [" (dictionary-decode-charset dictionary dictionary) "]:")
|
|
|
|
(put-text-property start (point) 'face 'dictionary-word-entry-face)
|
|
|
|
(insert "\n\n")))
|
2020-10-05 06:50:25 +02:00
|
|
|
|
|
|
|
(defun dictionary-display-word-definition (reply word dictionary)
|
A number of docstring fixes
* lisp/net/dictionary.el (dictionary-set-server-var, dictionary-mode,
dictionary, dictionary-new-buffer, dictionary-reply-code,
dictionary-reply, dictionary-reply-list, dictionary-open-server,
dictionary-check-connection, dictionary-mode-p, dictionary-close,
dictionary-read-reply, dictionary-split-string,
dictionary-read-reply-and-split, dictionary-read-answer,
dictionary-check-reply, dictionary-coding-system,
dictionary-decode-charset, dictionary-encode-charset,
dictionary-check-initial-reply, dictionary-store-state,
dictionary-restore-state, dictionary-new-search,
dictionary-new-search-internal, dictionary-do-search,
dictionary-pre-buffer, dictionary-post-buffer,
dictionary-display-search-result, dictionary-display-word-entry,
dictionary-display-word-definition, dictionary-mark-reference,
dictionary-select-dictionary, dictionary-display-dictionarys,
dictionary-display-dictionary-line, dictionary-set-dictionary,
dictionary-special-dictionary, dictionary-display-more-info,
dictionary-select-strategy, dictionary-do-select-strategy,
dictionary-display-strategies, dictionary-display-strategy-line,
dictionary-set-strategy, dictionary-new-matching,
dictionary-do-matching, dictionary-display-only-match-result,
dictionary-display-match-result, dictionary-display-match-result,
dictionary-display-match-lines, dictionary-search,
dictionary-previous, dictionary-help, dictionary-match-words,
dictionary-mouse-popup-matching-words,
dictionary-popup-matching-words, dictionary-tooltip-mode,
dictionary-tooltip-mouse-event): Fix docstring
The following kind of changes were made:
- finish first line with a full stop (.)
- mention parameter in upper-case whenever possible (considering the
length constraints)
2020-12-14 10:55:35 +01:00
|
|
|
"Insert the definition in REPLY for the current WORD from DICTIONARY.
|
|
|
|
It will replace links which are found in the REPLY and replace
|
2021-03-12 12:11:17 +01:00
|
|
|
them with buttons to perform a new search."
|
2020-10-05 06:50:25 +02:00
|
|
|
(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))
|
|
|
|
(if (search-forward-regexp regexp nil t)
|
|
|
|
(let ((match-start (match-beginning 2))
|
|
|
|
(match-end (match-end 2)))
|
2023-08-12 16:06:10 +02:00
|
|
|
(if (display-color-p)
|
2020-10-05 06:50:25 +02:00
|
|
|
;; Compensate for the replacement
|
|
|
|
(let ((brace-match-length (- (match-end 1)
|
|
|
|
(match-beginning 1))))
|
|
|
|
(setq match-start (- (match-beginning 2)
|
|
|
|
brace-match-length))
|
|
|
|
(setq match-end (- (match-end 2)
|
|
|
|
brace-match-length))
|
|
|
|
(replace-match "\\2")))
|
|
|
|
(dictionary-mark-reference match-start match-end
|
|
|
|
'dictionary-new-search
|
|
|
|
word dictionary))
|
|
|
|
(goto-char (point-max)))))))
|
|
|
|
|
|
|
|
(defun dictionary-mark-reference (start end call displayed-word dictionary)
|
A number of docstring fixes
* lisp/net/dictionary.el (dictionary-set-server-var, dictionary-mode,
dictionary, dictionary-new-buffer, dictionary-reply-code,
dictionary-reply, dictionary-reply-list, dictionary-open-server,
dictionary-check-connection, dictionary-mode-p, dictionary-close,
dictionary-read-reply, dictionary-split-string,
dictionary-read-reply-and-split, dictionary-read-answer,
dictionary-check-reply, dictionary-coding-system,
dictionary-decode-charset, dictionary-encode-charset,
dictionary-check-initial-reply, dictionary-store-state,
dictionary-restore-state, dictionary-new-search,
dictionary-new-search-internal, dictionary-do-search,
dictionary-pre-buffer, dictionary-post-buffer,
dictionary-display-search-result, dictionary-display-word-entry,
dictionary-display-word-definition, dictionary-mark-reference,
dictionary-select-dictionary, dictionary-display-dictionarys,
dictionary-display-dictionary-line, dictionary-set-dictionary,
dictionary-special-dictionary, dictionary-display-more-info,
dictionary-select-strategy, dictionary-do-select-strategy,
dictionary-display-strategies, dictionary-display-strategy-line,
dictionary-set-strategy, dictionary-new-matching,
dictionary-do-matching, dictionary-display-only-match-result,
dictionary-display-match-result, dictionary-display-match-result,
dictionary-display-match-lines, dictionary-search,
dictionary-previous, dictionary-help, dictionary-match-words,
dictionary-mouse-popup-matching-words,
dictionary-popup-matching-words, dictionary-tooltip-mode,
dictionary-tooltip-mouse-event): Fix docstring
The following kind of changes were made:
- finish first line with a full stop (.)
- mention parameter in upper-case whenever possible (considering the
length constraints)
2020-12-14 10:55:35 +01:00
|
|
|
"Format the area from START to END as link calling CALL.
|
|
|
|
The word is taken from the buffer, the DICTIONARY is given as argument."
|
2020-10-05 06:50:25 +02:00
|
|
|
(let ((word (buffer-substring-no-properties start end)))
|
|
|
|
(while (string-match "\n\\s-*" word)
|
|
|
|
(setq word (replace-match " " t t word)))
|
|
|
|
(while (string-match "[*\"]" word)
|
|
|
|
(setq word (replace-match "" t t word)))
|
2021-02-09 20:29:54 +02:00
|
|
|
(when dictionary-link-dictionary
|
|
|
|
(setq dictionary dictionary-link-dictionary))
|
2020-10-05 06:50:25 +02:00
|
|
|
|
|
|
|
(unless (equal word displayed-word)
|
2020-10-09 05:00:02 +02:00
|
|
|
(make-button start end :type 'dictionary-link
|
|
|
|
'callback call
|
|
|
|
'data (cons word dictionary)
|
|
|
|
'help-echo (concat "Press Mouse-2 to lookup \""
|
|
|
|
word "\" in \"" dictionary "\"")))))
|
2020-10-05 06:50:25 +02:00
|
|
|
|
2021-03-08 10:11:22 -05:00
|
|
|
(defun dictionary-select-dictionary (&rest _ignored)
|
A number of docstring fixes
* lisp/net/dictionary.el (dictionary-set-server-var, dictionary-mode,
dictionary, dictionary-new-buffer, dictionary-reply-code,
dictionary-reply, dictionary-reply-list, dictionary-open-server,
dictionary-check-connection, dictionary-mode-p, dictionary-close,
dictionary-read-reply, dictionary-split-string,
dictionary-read-reply-and-split, dictionary-read-answer,
dictionary-check-reply, dictionary-coding-system,
dictionary-decode-charset, dictionary-encode-charset,
dictionary-check-initial-reply, dictionary-store-state,
dictionary-restore-state, dictionary-new-search,
dictionary-new-search-internal, dictionary-do-search,
dictionary-pre-buffer, dictionary-post-buffer,
dictionary-display-search-result, dictionary-display-word-entry,
dictionary-display-word-definition, dictionary-mark-reference,
dictionary-select-dictionary, dictionary-display-dictionarys,
dictionary-display-dictionary-line, dictionary-set-dictionary,
dictionary-special-dictionary, dictionary-display-more-info,
dictionary-select-strategy, dictionary-do-select-strategy,
dictionary-display-strategies, dictionary-display-strategy-line,
dictionary-set-strategy, dictionary-new-matching,
dictionary-do-matching, dictionary-display-only-match-result,
dictionary-display-match-result, dictionary-display-match-result,
dictionary-display-match-lines, dictionary-search,
dictionary-previous, dictionary-help, dictionary-match-words,
dictionary-mouse-popup-matching-words,
dictionary-popup-matching-words, dictionary-tooltip-mode,
dictionary-tooltip-mouse-event): Fix docstring
The following kind of changes were made:
- finish first line with a full stop (.)
- mention parameter in upper-case whenever possible (considering the
length constraints)
2020-12-14 10:55:35 +01:00
|
|
|
"Save the current state and start a dictionary selection."
|
2020-10-05 06:50:25 +02:00
|
|
|
(interactive)
|
|
|
|
(dictionary-ensure-buffer)
|
|
|
|
(dictionary-store-positions)
|
|
|
|
(dictionary-do-select-dictionary)
|
|
|
|
(dictionary-store-state 'dictionary-do-select-dictionary nil))
|
|
|
|
|
2021-03-08 10:11:22 -05:00
|
|
|
(defun dictionary-do-select-dictionary (&rest _ignored)
|
2020-10-05 06:50:25 +02:00
|
|
|
"The workhorse for doing the dictionary selection."
|
|
|
|
|
|
|
|
(message "Looking up databases and descriptions")
|
|
|
|
(dictionary-send-command "show db")
|
|
|
|
|
|
|
|
(let ((reply (dictionary-read-reply-and-split)))
|
|
|
|
(message nil)
|
|
|
|
(if (dictionary-check-reply reply 554)
|
|
|
|
(error "No dictionary present")
|
|
|
|
(unless (dictionary-check-reply reply 110)
|
|
|
|
(error "Unknown server answer: %s"
|
|
|
|
(dictionary-reply reply)))
|
Fix typos
* doc/lispref/display.texi (Size of Displayed Text):
* doc/lispref/windows.texi (Buffer Display Action Functions):
* etc/NEWS:
* etc/ORG-NEWS (Org-Attach has been refactored and extended):
* lisp/battery.el (display-battery-mode, battery--upower-subsribe):
* lisp/calendar/parse-time.el:
* lisp/dired-x.el:
* lisp/emacs-lisp/chart.el (chart-sequece, chart-bar-quickie):
* lisp/emacs-lisp/eldoc.el (eldoc-echo-area-use-multiline-p)
(eldoc-documentation-strategy):
* lisp/emacs-lisp/pcase.el (pcase--split-pred, pcase--u1):
* lisp/gnus/gnus-search.el (gnus-search-expandable-keys)
(gnus-search-parse-query, gnus-search-query-return-string)
(gnus-search-imap, gnus-search-imap-search-command)
(gnus-search-transform-expression):
* lisp/gnus/nnselect.el:
* lisp/isearch.el (isearch-lazy-count-format):
* lisp/mh-e/mh-show.el (mh-show-msg):
* lisp/net/dictionary-connection.el (dictionary-connection-open):
* lisp/net/dictionary.el (dictionary-default-popup-strategy)
(dictionary, dictionary-split-string, dictionary-do-select-dictionary)
(dictionary-display-dictionarys, dictionary-search)
(dictionary-tooltip-mode):
* lisp/net/eudcb-macos-contacts.el (eudc-macos-contacts-set-server):
* lisp/net/mailcap.el (mailcap-mime-data):
* lisp/net/tramp-smb.el (tramp-smb-maybe-open-connection):
* lisp/nxml/nxml-mode.el (nxml-mode):
* lisp/progmodes/cc-engine.el:
* lisp/progmodes/cperl-mode.el (cperl-mode)
(cperl-fontify-syntaxically):
* lisp/progmodes/flymake.el (flymake-diagnostic-functions):
* lisp/progmodes/verilog-mode.el (verilog--supressed-warnings)
(verilog-preprocess):
* lisp/simple.el (self-insert-uses-region-functions):
* lisp/textmodes/bibtex.el (bibtex-copy-summary-as-kill):
* lisp/textmodes/texnfo-upd.el (texinfo-insert-master-menu-list):
* src/dispnew.c:
* src/font.c (Ffont_get):
* src/indent.c (compute_motion):
* src/process.c (init_process_emacs):
* src/w32fns.c (deliver_wm_chars):
* test/lisp/jsonrpc-tests.el (deferred-action-complex-tests):
Fix typos in documentation, comments, and internal identifiers.
2021-02-18 16:41:36 +01:00
|
|
|
(dictionary-display-dictionaries))))
|
2020-10-05 06:50:25 +02:00
|
|
|
|
|
|
|
(defun dictionary-simple-split-string (string &optional pattern)
|
|
|
|
"Return a list of substrings of STRING which are separated by PATTERN.
|
|
|
|
If PATTERN is omitted, it defaults to \"[ \\f\\t\\n\\r\\v]+\"."
|
|
|
|
(or pattern
|
|
|
|
(setq pattern "[ \f\t\n\r\v]+"))
|
|
|
|
;; The FSF version of this function takes care not to cons in case
|
|
|
|
;; of infloop. Maybe we should synch?
|
|
|
|
(let (parts (start 0))
|
|
|
|
(while (string-match pattern string start)
|
|
|
|
(setq parts (cons (substring string start (match-beginning 0)) parts)
|
|
|
|
start (match-end 0)))
|
|
|
|
(nreverse (cons (substring string start) parts))))
|
|
|
|
|
Fix typos
* doc/lispref/display.texi (Size of Displayed Text):
* doc/lispref/windows.texi (Buffer Display Action Functions):
* etc/NEWS:
* etc/ORG-NEWS (Org-Attach has been refactored and extended):
* lisp/battery.el (display-battery-mode, battery--upower-subsribe):
* lisp/calendar/parse-time.el:
* lisp/dired-x.el:
* lisp/emacs-lisp/chart.el (chart-sequece, chart-bar-quickie):
* lisp/emacs-lisp/eldoc.el (eldoc-echo-area-use-multiline-p)
(eldoc-documentation-strategy):
* lisp/emacs-lisp/pcase.el (pcase--split-pred, pcase--u1):
* lisp/gnus/gnus-search.el (gnus-search-expandable-keys)
(gnus-search-parse-query, gnus-search-query-return-string)
(gnus-search-imap, gnus-search-imap-search-command)
(gnus-search-transform-expression):
* lisp/gnus/nnselect.el:
* lisp/isearch.el (isearch-lazy-count-format):
* lisp/mh-e/mh-show.el (mh-show-msg):
* lisp/net/dictionary-connection.el (dictionary-connection-open):
* lisp/net/dictionary.el (dictionary-default-popup-strategy)
(dictionary, dictionary-split-string, dictionary-do-select-dictionary)
(dictionary-display-dictionarys, dictionary-search)
(dictionary-tooltip-mode):
* lisp/net/eudcb-macos-contacts.el (eudc-macos-contacts-set-server):
* lisp/net/mailcap.el (mailcap-mime-data):
* lisp/net/tramp-smb.el (tramp-smb-maybe-open-connection):
* lisp/nxml/nxml-mode.el (nxml-mode):
* lisp/progmodes/cc-engine.el:
* lisp/progmodes/cperl-mode.el (cperl-mode)
(cperl-fontify-syntaxically):
* lisp/progmodes/flymake.el (flymake-diagnostic-functions):
* lisp/progmodes/verilog-mode.el (verilog--supressed-warnings)
(verilog-preprocess):
* lisp/simple.el (self-insert-uses-region-functions):
* lisp/textmodes/bibtex.el (bibtex-copy-summary-as-kill):
* lisp/textmodes/texnfo-upd.el (texinfo-insert-master-menu-list):
* src/dispnew.c:
* src/font.c (Ffont_get):
* src/indent.c (compute_motion):
* src/process.c (init_process_emacs):
* src/w32fns.c (deliver_wm_chars):
* test/lisp/jsonrpc-tests.el (deferred-action-complex-tests):
Fix typos in documentation, comments, and internal identifiers.
2021-02-18 16:41:36 +01:00
|
|
|
(defun dictionary-display-dictionaries ()
|
A number of docstring fixes
* lisp/net/dictionary.el (dictionary-set-server-var, dictionary-mode,
dictionary, dictionary-new-buffer, dictionary-reply-code,
dictionary-reply, dictionary-reply-list, dictionary-open-server,
dictionary-check-connection, dictionary-mode-p, dictionary-close,
dictionary-read-reply, dictionary-split-string,
dictionary-read-reply-and-split, dictionary-read-answer,
dictionary-check-reply, dictionary-coding-system,
dictionary-decode-charset, dictionary-encode-charset,
dictionary-check-initial-reply, dictionary-store-state,
dictionary-restore-state, dictionary-new-search,
dictionary-new-search-internal, dictionary-do-search,
dictionary-pre-buffer, dictionary-post-buffer,
dictionary-display-search-result, dictionary-display-word-entry,
dictionary-display-word-definition, dictionary-mark-reference,
dictionary-select-dictionary, dictionary-display-dictionarys,
dictionary-display-dictionary-line, dictionary-set-dictionary,
dictionary-special-dictionary, dictionary-display-more-info,
dictionary-select-strategy, dictionary-do-select-strategy,
dictionary-display-strategies, dictionary-display-strategy-line,
dictionary-set-strategy, dictionary-new-matching,
dictionary-do-matching, dictionary-display-only-match-result,
dictionary-display-match-result, dictionary-display-match-result,
dictionary-display-match-lines, dictionary-search,
dictionary-previous, dictionary-help, dictionary-match-words,
dictionary-mouse-popup-matching-words,
dictionary-popup-matching-words, dictionary-tooltip-mode,
dictionary-tooltip-mouse-event): Fix docstring
The following kind of changes were made:
- finish first line with a full stop (.)
- mention parameter in upper-case whenever possible (considering the
length constraints)
2020-12-14 10:55:35 +01:00
|
|
|
"Handle the display of all dictionaries existing on the server."
|
2020-10-05 06:50:25 +02:00
|
|
|
(dictionary-pre-buffer)
|
|
|
|
(insert "Please select your default dictionary:\n\n")
|
|
|
|
(dictionary-display-dictionary-line "* \"All dictionaries\"")
|
|
|
|
(dictionary-display-dictionary-line "! \"The first matching dictionary\"")
|
|
|
|
(let* ((reply (dictionary-read-answer))
|
|
|
|
(list (dictionary-simple-split-string reply "\n+")))
|
2021-03-08 10:11:22 -05:00
|
|
|
(mapc #'dictionary-display-dictionary-line list))
|
2020-10-05 06:50:25 +02:00
|
|
|
(dictionary-post-buffer))
|
|
|
|
|
|
|
|
(defun dictionary-display-dictionary-line (string)
|
A number of docstring fixes
* lisp/net/dictionary.el (dictionary-set-server-var, dictionary-mode,
dictionary, dictionary-new-buffer, dictionary-reply-code,
dictionary-reply, dictionary-reply-list, dictionary-open-server,
dictionary-check-connection, dictionary-mode-p, dictionary-close,
dictionary-read-reply, dictionary-split-string,
dictionary-read-reply-and-split, dictionary-read-answer,
dictionary-check-reply, dictionary-coding-system,
dictionary-decode-charset, dictionary-encode-charset,
dictionary-check-initial-reply, dictionary-store-state,
dictionary-restore-state, dictionary-new-search,
dictionary-new-search-internal, dictionary-do-search,
dictionary-pre-buffer, dictionary-post-buffer,
dictionary-display-search-result, dictionary-display-word-entry,
dictionary-display-word-definition, dictionary-mark-reference,
dictionary-select-dictionary, dictionary-display-dictionarys,
dictionary-display-dictionary-line, dictionary-set-dictionary,
dictionary-special-dictionary, dictionary-display-more-info,
dictionary-select-strategy, dictionary-do-select-strategy,
dictionary-display-strategies, dictionary-display-strategy-line,
dictionary-set-strategy, dictionary-new-matching,
dictionary-do-matching, dictionary-display-only-match-result,
dictionary-display-match-result, dictionary-display-match-result,
dictionary-display-match-lines, dictionary-search,
dictionary-previous, dictionary-help, dictionary-match-words,
dictionary-mouse-popup-matching-words,
dictionary-popup-matching-words, dictionary-tooltip-mode,
dictionary-tooltip-mouse-event): Fix docstring
The following kind of changes were made:
- finish first line with a full stop (.)
- mention parameter in upper-case whenever possible (considering the
length constraints)
2020-12-14 10:55:35 +01:00
|
|
|
"Display a single dictionary and its description read from STRING."
|
2020-10-05 06:50:25 +02:00
|
|
|
(let* ((list (dictionary-split-string string))
|
|
|
|
(dictionary (car list))
|
|
|
|
(description (cadr list))
|
|
|
|
(translated (dictionary-decode-charset description dictionary)))
|
|
|
|
(if dictionary
|
|
|
|
(if (equal dictionary "--exit--")
|
|
|
|
(insert "(end of default search list)\n")
|
2020-10-09 05:00:02 +02:00
|
|
|
(insert-button (concat dictionary ": " translated) :type 'dictionary-link
|
|
|
|
'callback 'dictionary-set-dictionary
|
|
|
|
'data (cons dictionary description)
|
2022-07-10 17:09:18 +02:00
|
|
|
'help-echo "Mouse-2 to select this dictionary")
|
2020-10-09 06:04:35 +02:00
|
|
|
(unless (dictionary-special-dictionary dictionary)
|
|
|
|
(insert " ")
|
|
|
|
(insert-button "(Details)" :type 'dictionary-link
|
|
|
|
'callback 'dictionary-set-dictionary
|
|
|
|
'list-data (list (cons dictionary description) t)
|
2022-07-10 17:09:18 +02:00
|
|
|
'help-echo "Mouse-2 to get more information"))
|
2020-10-05 06:50:25 +02:00
|
|
|
(insert "\n")))))
|
|
|
|
|
|
|
|
(defun dictionary-set-dictionary (param &optional more)
|
A number of docstring fixes
* lisp/net/dictionary.el (dictionary-set-server-var, dictionary-mode,
dictionary, dictionary-new-buffer, dictionary-reply-code,
dictionary-reply, dictionary-reply-list, dictionary-open-server,
dictionary-check-connection, dictionary-mode-p, dictionary-close,
dictionary-read-reply, dictionary-split-string,
dictionary-read-reply-and-split, dictionary-read-answer,
dictionary-check-reply, dictionary-coding-system,
dictionary-decode-charset, dictionary-encode-charset,
dictionary-check-initial-reply, dictionary-store-state,
dictionary-restore-state, dictionary-new-search,
dictionary-new-search-internal, dictionary-do-search,
dictionary-pre-buffer, dictionary-post-buffer,
dictionary-display-search-result, dictionary-display-word-entry,
dictionary-display-word-definition, dictionary-mark-reference,
dictionary-select-dictionary, dictionary-display-dictionarys,
dictionary-display-dictionary-line, dictionary-set-dictionary,
dictionary-special-dictionary, dictionary-display-more-info,
dictionary-select-strategy, dictionary-do-select-strategy,
dictionary-display-strategies, dictionary-display-strategy-line,
dictionary-set-strategy, dictionary-new-matching,
dictionary-do-matching, dictionary-display-only-match-result,
dictionary-display-match-result, dictionary-display-match-result,
dictionary-display-match-lines, dictionary-search,
dictionary-previous, dictionary-help, dictionary-match-words,
dictionary-mouse-popup-matching-words,
dictionary-popup-matching-words, dictionary-tooltip-mode,
dictionary-tooltip-mouse-event): Fix docstring
The following kind of changes were made:
- finish first line with a full stop (.)
- mention parameter in upper-case whenever possible (considering the
length constraints)
2020-12-14 10:55:35 +01:00
|
|
|
"Select the dictionary which is the car of PARAM as new default."
|
2020-10-05 06:50:25 +02:00
|
|
|
(if more
|
|
|
|
(dictionary-display-more-info param)
|
|
|
|
(let ((dictionary (car param)))
|
|
|
|
(setq dictionary-default-dictionary dictionary)
|
|
|
|
(dictionary-restore-state)
|
|
|
|
(message "Dictionary %s has been selected" dictionary))))
|
|
|
|
|
2020-10-09 06:04:35 +02:00
|
|
|
(defun dictionary-special-dictionary (name)
|
Various doc fixes in dictionary.el
* lisp/net/dictionary.el (dictionary-set-server-var)
(dictionary-server, dictionary-port)
(dictionary-default-dictionary)
(dictionary-default-popup-strategy, dictionary-proxy-server)
(dictionary-proxy-port, dictionary-description-open-delimiter)
(dictionary-description-close-delimiter)
(dictionary-window-configuration, dictionary-selected-window)
(dictionary-position-stack, dictionary-data-stack)
(dictionary-positions, dictionary-current-data)
(dictionary-connection, dictionary-instances)
(dictionary-color-support, dictionary-word-history)
(dictionary-mode, dictionary, dictionary-check-connection)
(dictionary-mode-p, dictionary-send-command)
(dictionary-read-reply-and-split, dictionary-check-reply)
(dictionary-check-initial-reply, dictionary-store-state)
(dictionary-store-positions, dictionary-new-search)
(dictionary-new-search-internal, dictionary-do-search)
(dictionary-display-search-result)
(dictionary-display-word-definition)
(dictionary-special-dictionary, dictionary-set-strategy)
(dictionary-tooltip-dictionary, dictionary-switch-tooltip-mode)
(dictionary-tooltip-mode, global-dictionary-tooltip-mode): Doc fixes
to adhere to our conventions.
2021-02-07 15:53:46 +01:00
|
|
|
"Check whether the special * or ! dictionary are seen in NAME."
|
2020-10-09 06:04:35 +02:00
|
|
|
(or (equal name "*")
|
|
|
|
(equal name "!")))
|
|
|
|
|
2020-10-05 06:50:25 +02:00
|
|
|
(defun dictionary-display-more-info (param)
|
A number of docstring fixes
* lisp/net/dictionary.el (dictionary-set-server-var, dictionary-mode,
dictionary, dictionary-new-buffer, dictionary-reply-code,
dictionary-reply, dictionary-reply-list, dictionary-open-server,
dictionary-check-connection, dictionary-mode-p, dictionary-close,
dictionary-read-reply, dictionary-split-string,
dictionary-read-reply-and-split, dictionary-read-answer,
dictionary-check-reply, dictionary-coding-system,
dictionary-decode-charset, dictionary-encode-charset,
dictionary-check-initial-reply, dictionary-store-state,
dictionary-restore-state, dictionary-new-search,
dictionary-new-search-internal, dictionary-do-search,
dictionary-pre-buffer, dictionary-post-buffer,
dictionary-display-search-result, dictionary-display-word-entry,
dictionary-display-word-definition, dictionary-mark-reference,
dictionary-select-dictionary, dictionary-display-dictionarys,
dictionary-display-dictionary-line, dictionary-set-dictionary,
dictionary-special-dictionary, dictionary-display-more-info,
dictionary-select-strategy, dictionary-do-select-strategy,
dictionary-display-strategies, dictionary-display-strategy-line,
dictionary-set-strategy, dictionary-new-matching,
dictionary-do-matching, dictionary-display-only-match-result,
dictionary-display-match-result, dictionary-display-match-result,
dictionary-display-match-lines, dictionary-search,
dictionary-previous, dictionary-help, dictionary-match-words,
dictionary-mouse-popup-matching-words,
dictionary-popup-matching-words, dictionary-tooltip-mode,
dictionary-tooltip-mouse-event): Fix docstring
The following kind of changes were made:
- finish first line with a full stop (.)
- mention parameter in upper-case whenever possible (considering the
length constraints)
2020-12-14 10:55:35 +01:00
|
|
|
"Display the available information on the dictionary found in PARAM."
|
2020-10-05 06:50:25 +02:00
|
|
|
|
|
|
|
(let ((dictionary (car param))
|
|
|
|
(description (cdr param)))
|
2020-10-09 06:04:35 +02:00
|
|
|
(unless (dictionary-special-dictionary dictionary)
|
2020-10-05 06:50:25 +02:00
|
|
|
(dictionary-store-positions)
|
|
|
|
(message "Requesting more information on %s" dictionary)
|
|
|
|
(dictionary-send-command
|
|
|
|
(concat "show info " (dictionary-encode-charset dictionary "")))
|
|
|
|
(let ((reply (dictionary-read-reply-and-split)))
|
|
|
|
(message nil)
|
|
|
|
(if (dictionary-check-reply reply 550)
|
2020-12-14 09:52:23 +01:00
|
|
|
(error "Dictionary \"%s\" does not exist" dictionary)
|
2020-10-05 06:50:25 +02:00
|
|
|
(unless (dictionary-check-reply reply 112)
|
|
|
|
(error "Unknown server answer: %s" (dictionary-reply reply)))
|
|
|
|
(dictionary-pre-buffer)
|
|
|
|
(insert "Information on dictionary: ")
|
2020-10-09 05:00:02 +02:00
|
|
|
(insert-button description :type 'dictionary-link
|
|
|
|
'callback 'dictionary-set-dictionary
|
|
|
|
'data (cons dictionary description)
|
2022-07-10 17:09:18 +02:00
|
|
|
'help-echo "Mouse-2 to select this dictionary")
|
2020-10-05 06:50:25 +02:00
|
|
|
(insert "\n\n")
|
|
|
|
(setq reply (dictionary-read-answer))
|
|
|
|
(insert reply)
|
|
|
|
(dictionary-post-buffer)))
|
|
|
|
|
|
|
|
(dictionary-store-state 'dictionary-display-more-info dictionary))))
|
|
|
|
|
2021-03-08 10:11:22 -05:00
|
|
|
(defun dictionary-select-strategy (&rest _ignored)
|
A number of docstring fixes
* lisp/net/dictionary.el (dictionary-set-server-var, dictionary-mode,
dictionary, dictionary-new-buffer, dictionary-reply-code,
dictionary-reply, dictionary-reply-list, dictionary-open-server,
dictionary-check-connection, dictionary-mode-p, dictionary-close,
dictionary-read-reply, dictionary-split-string,
dictionary-read-reply-and-split, dictionary-read-answer,
dictionary-check-reply, dictionary-coding-system,
dictionary-decode-charset, dictionary-encode-charset,
dictionary-check-initial-reply, dictionary-store-state,
dictionary-restore-state, dictionary-new-search,
dictionary-new-search-internal, dictionary-do-search,
dictionary-pre-buffer, dictionary-post-buffer,
dictionary-display-search-result, dictionary-display-word-entry,
dictionary-display-word-definition, dictionary-mark-reference,
dictionary-select-dictionary, dictionary-display-dictionarys,
dictionary-display-dictionary-line, dictionary-set-dictionary,
dictionary-special-dictionary, dictionary-display-more-info,
dictionary-select-strategy, dictionary-do-select-strategy,
dictionary-display-strategies, dictionary-display-strategy-line,
dictionary-set-strategy, dictionary-new-matching,
dictionary-do-matching, dictionary-display-only-match-result,
dictionary-display-match-result, dictionary-display-match-result,
dictionary-display-match-lines, dictionary-search,
dictionary-previous, dictionary-help, dictionary-match-words,
dictionary-mouse-popup-matching-words,
dictionary-popup-matching-words, dictionary-tooltip-mode,
dictionary-tooltip-mouse-event): Fix docstring
The following kind of changes were made:
- finish first line with a full stop (.)
- mention parameter in upper-case whenever possible (considering the
length constraints)
2020-12-14 10:55:35 +01:00
|
|
|
"Save the current state and start a strategy selection."
|
2020-10-05 06:50:25 +02:00
|
|
|
(interactive)
|
|
|
|
(dictionary-ensure-buffer)
|
|
|
|
(dictionary-store-positions)
|
|
|
|
(dictionary-do-select-strategy)
|
|
|
|
(dictionary-store-state 'dictionary-do-select-strategy nil))
|
|
|
|
|
|
|
|
(defun dictionary-do-select-strategy ()
|
|
|
|
"The workhorse for doing the strategy selection."
|
|
|
|
|
|
|
|
(message "Request existing matching algorithm")
|
|
|
|
(dictionary-send-command "show strat")
|
|
|
|
|
|
|
|
(let ((reply (dictionary-read-reply-and-split)))
|
|
|
|
(message nil)
|
|
|
|
(if (dictionary-check-reply reply 555)
|
|
|
|
(error "No strategies available")
|
|
|
|
(unless (dictionary-check-reply reply 111)
|
|
|
|
(error "Unknown server answer: %s"
|
|
|
|
(dictionary-reply reply)))
|
2020-11-19 21:39:10 +01:00
|
|
|
(dictionary-display-strategies))))
|
2020-10-05 06:50:25 +02:00
|
|
|
|
2020-11-19 21:39:10 +01:00
|
|
|
(defun dictionary-display-strategies ()
|
A number of docstring fixes
* lisp/net/dictionary.el (dictionary-set-server-var, dictionary-mode,
dictionary, dictionary-new-buffer, dictionary-reply-code,
dictionary-reply, dictionary-reply-list, dictionary-open-server,
dictionary-check-connection, dictionary-mode-p, dictionary-close,
dictionary-read-reply, dictionary-split-string,
dictionary-read-reply-and-split, dictionary-read-answer,
dictionary-check-reply, dictionary-coding-system,
dictionary-decode-charset, dictionary-encode-charset,
dictionary-check-initial-reply, dictionary-store-state,
dictionary-restore-state, dictionary-new-search,
dictionary-new-search-internal, dictionary-do-search,
dictionary-pre-buffer, dictionary-post-buffer,
dictionary-display-search-result, dictionary-display-word-entry,
dictionary-display-word-definition, dictionary-mark-reference,
dictionary-select-dictionary, dictionary-display-dictionarys,
dictionary-display-dictionary-line, dictionary-set-dictionary,
dictionary-special-dictionary, dictionary-display-more-info,
dictionary-select-strategy, dictionary-do-select-strategy,
dictionary-display-strategies, dictionary-display-strategy-line,
dictionary-set-strategy, dictionary-new-matching,
dictionary-do-matching, dictionary-display-only-match-result,
dictionary-display-match-result, dictionary-display-match-result,
dictionary-display-match-lines, dictionary-search,
dictionary-previous, dictionary-help, dictionary-match-words,
dictionary-mouse-popup-matching-words,
dictionary-popup-matching-words, dictionary-tooltip-mode,
dictionary-tooltip-mouse-event): Fix docstring
The following kind of changes were made:
- finish first line with a full stop (.)
- mention parameter in upper-case whenever possible (considering the
length constraints)
2020-12-14 10:55:35 +01:00
|
|
|
"Handle the display of all strategies existing on the server."
|
2020-10-05 06:50:25 +02:00
|
|
|
(dictionary-pre-buffer)
|
|
|
|
(insert "Please select your default search strategy:\n\n")
|
|
|
|
(dictionary-display-strategy-line ". \"The servers default\"")
|
|
|
|
(let* ((reply (dictionary-read-answer))
|
|
|
|
(list (dictionary-simple-split-string reply "\n+")))
|
2021-03-08 10:11:22 -05:00
|
|
|
(mapc #'dictionary-display-strategy-line list))
|
2020-10-05 06:50:25 +02:00
|
|
|
(dictionary-post-buffer))
|
|
|
|
|
|
|
|
(defun dictionary-display-strategy-line (string)
|
A number of docstring fixes
* lisp/net/dictionary.el (dictionary-set-server-var, dictionary-mode,
dictionary, dictionary-new-buffer, dictionary-reply-code,
dictionary-reply, dictionary-reply-list, dictionary-open-server,
dictionary-check-connection, dictionary-mode-p, dictionary-close,
dictionary-read-reply, dictionary-split-string,
dictionary-read-reply-and-split, dictionary-read-answer,
dictionary-check-reply, dictionary-coding-system,
dictionary-decode-charset, dictionary-encode-charset,
dictionary-check-initial-reply, dictionary-store-state,
dictionary-restore-state, dictionary-new-search,
dictionary-new-search-internal, dictionary-do-search,
dictionary-pre-buffer, dictionary-post-buffer,
dictionary-display-search-result, dictionary-display-word-entry,
dictionary-display-word-definition, dictionary-mark-reference,
dictionary-select-dictionary, dictionary-display-dictionarys,
dictionary-display-dictionary-line, dictionary-set-dictionary,
dictionary-special-dictionary, dictionary-display-more-info,
dictionary-select-strategy, dictionary-do-select-strategy,
dictionary-display-strategies, dictionary-display-strategy-line,
dictionary-set-strategy, dictionary-new-matching,
dictionary-do-matching, dictionary-display-only-match-result,
dictionary-display-match-result, dictionary-display-match-result,
dictionary-display-match-lines, dictionary-search,
dictionary-previous, dictionary-help, dictionary-match-words,
dictionary-mouse-popup-matching-words,
dictionary-popup-matching-words, dictionary-tooltip-mode,
dictionary-tooltip-mouse-event): Fix docstring
The following kind of changes were made:
- finish first line with a full stop (.)
- mention parameter in upper-case whenever possible (considering the
length constraints)
2020-12-14 10:55:35 +01:00
|
|
|
"Display a single strategy found in STRING."
|
2020-10-05 06:50:25 +02:00
|
|
|
(let* ((list (dictionary-split-string string))
|
|
|
|
(strategy (car list))
|
|
|
|
(description (cadr list)))
|
|
|
|
(if strategy
|
|
|
|
(progn
|
2020-10-09 05:00:02 +02:00
|
|
|
(insert-button description :type 'dictionary-link
|
|
|
|
'callback 'dictionary-set-strategy
|
|
|
|
'data strategy
|
2022-07-10 17:09:18 +02:00
|
|
|
'help-echo "Mouse-2 to select this matching algorithm")
|
2020-10-05 06:50:25 +02:00
|
|
|
(insert "\n")))))
|
|
|
|
|
2021-03-08 10:11:22 -05:00
|
|
|
(defun dictionary-set-strategy (strategy &rest _ignored)
|
Various doc fixes in dictionary.el
* lisp/net/dictionary.el (dictionary-set-server-var)
(dictionary-server, dictionary-port)
(dictionary-default-dictionary)
(dictionary-default-popup-strategy, dictionary-proxy-server)
(dictionary-proxy-port, dictionary-description-open-delimiter)
(dictionary-description-close-delimiter)
(dictionary-window-configuration, dictionary-selected-window)
(dictionary-position-stack, dictionary-data-stack)
(dictionary-positions, dictionary-current-data)
(dictionary-connection, dictionary-instances)
(dictionary-color-support, dictionary-word-history)
(dictionary-mode, dictionary, dictionary-check-connection)
(dictionary-mode-p, dictionary-send-command)
(dictionary-read-reply-and-split, dictionary-check-reply)
(dictionary-check-initial-reply, dictionary-store-state)
(dictionary-store-positions, dictionary-new-search)
(dictionary-new-search-internal, dictionary-do-search)
(dictionary-display-search-result)
(dictionary-display-word-definition)
(dictionary-special-dictionary, dictionary-set-strategy)
(dictionary-tooltip-dictionary, dictionary-switch-tooltip-mode)
(dictionary-tooltip-mode, global-dictionary-tooltip-mode): Doc fixes
to adhere to our conventions.
2021-02-07 15:53:46 +01:00
|
|
|
"Select this STRATEGY as new default."
|
2020-10-05 06:50:25 +02:00
|
|
|
(setq dictionary-default-strategy strategy)
|
|
|
|
(dictionary-restore-state)
|
|
|
|
(message "Strategy %s has been selected" strategy))
|
|
|
|
|
|
|
|
(defun dictionary-new-matching (word)
|
A number of docstring fixes
* lisp/net/dictionary.el (dictionary-set-server-var, dictionary-mode,
dictionary, dictionary-new-buffer, dictionary-reply-code,
dictionary-reply, dictionary-reply-list, dictionary-open-server,
dictionary-check-connection, dictionary-mode-p, dictionary-close,
dictionary-read-reply, dictionary-split-string,
dictionary-read-reply-and-split, dictionary-read-answer,
dictionary-check-reply, dictionary-coding-system,
dictionary-decode-charset, dictionary-encode-charset,
dictionary-check-initial-reply, dictionary-store-state,
dictionary-restore-state, dictionary-new-search,
dictionary-new-search-internal, dictionary-do-search,
dictionary-pre-buffer, dictionary-post-buffer,
dictionary-display-search-result, dictionary-display-word-entry,
dictionary-display-word-definition, dictionary-mark-reference,
dictionary-select-dictionary, dictionary-display-dictionarys,
dictionary-display-dictionary-line, dictionary-set-dictionary,
dictionary-special-dictionary, dictionary-display-more-info,
dictionary-select-strategy, dictionary-do-select-strategy,
dictionary-display-strategies, dictionary-display-strategy-line,
dictionary-set-strategy, dictionary-new-matching,
dictionary-do-matching, dictionary-display-only-match-result,
dictionary-display-match-result, dictionary-display-match-result,
dictionary-display-match-lines, dictionary-search,
dictionary-previous, dictionary-help, dictionary-match-words,
dictionary-mouse-popup-matching-words,
dictionary-popup-matching-words, dictionary-tooltip-mode,
dictionary-tooltip-mouse-event): Fix docstring
The following kind of changes were made:
- finish first line with a full stop (.)
- mention parameter in upper-case whenever possible (considering the
length constraints)
2020-12-14 10:55:35 +01:00
|
|
|
"Run a new matching search on WORD."
|
2020-10-05 06:50:25 +02:00
|
|
|
(dictionary-ensure-buffer)
|
|
|
|
(dictionary-store-positions)
|
|
|
|
(dictionary-do-matching word dictionary-default-dictionary
|
|
|
|
dictionary-default-strategy
|
|
|
|
'dictionary-display-match-result)
|
|
|
|
(dictionary-store-state 'dictionary-do-matching
|
|
|
|
(list word dictionary-default-dictionary
|
|
|
|
dictionary-default-strategy
|
|
|
|
'dictionary-display-match-result)))
|
|
|
|
|
|
|
|
(defun dictionary-do-matching (word dictionary strategy function)
|
2021-09-24 14:46:56 +02:00
|
|
|
"Search for WORD with STRATEGY in DICTIONARY and display them with FUNCTION."
|
2020-10-05 06:50:25 +02:00
|
|
|
(message "Lookup matching words for %s in %s using %s"
|
|
|
|
word dictionary strategy)
|
|
|
|
(dictionary-send-command
|
|
|
|
(concat "match " (dictionary-encode-charset dictionary "") " "
|
|
|
|
(dictionary-encode-charset strategy "") " \""
|
|
|
|
(dictionary-encode-charset word "") "\""))
|
|
|
|
(let ((reply (dictionary-read-reply-and-split)))
|
|
|
|
(message nil)
|
|
|
|
(if (dictionary-check-reply reply 550)
|
|
|
|
(error "Dictionary \"%s\" is invalid" dictionary))
|
|
|
|
(if (dictionary-check-reply reply 551)
|
|
|
|
(error "Strategy \"%s\" is invalid" strategy))
|
|
|
|
(if (dictionary-check-reply reply 552)
|
|
|
|
(error (concat
|
|
|
|
"No match for \"%s\" with strategy \"%s\" in "
|
|
|
|
"dictionary \"%s\".")
|
|
|
|
word strategy dictionary))
|
|
|
|
(unless (dictionary-check-reply reply 152)
|
|
|
|
(error "Unknown server answer: %s" (dictionary-reply reply)))
|
|
|
|
(funcall function reply)))
|
|
|
|
|
|
|
|
(defun dictionary-display-only-match-result (reply)
|
A number of docstring fixes
* lisp/net/dictionary.el (dictionary-set-server-var, dictionary-mode,
dictionary, dictionary-new-buffer, dictionary-reply-code,
dictionary-reply, dictionary-reply-list, dictionary-open-server,
dictionary-check-connection, dictionary-mode-p, dictionary-close,
dictionary-read-reply, dictionary-split-string,
dictionary-read-reply-and-split, dictionary-read-answer,
dictionary-check-reply, dictionary-coding-system,
dictionary-decode-charset, dictionary-encode-charset,
dictionary-check-initial-reply, dictionary-store-state,
dictionary-restore-state, dictionary-new-search,
dictionary-new-search-internal, dictionary-do-search,
dictionary-pre-buffer, dictionary-post-buffer,
dictionary-display-search-result, dictionary-display-word-entry,
dictionary-display-word-definition, dictionary-mark-reference,
dictionary-select-dictionary, dictionary-display-dictionarys,
dictionary-display-dictionary-line, dictionary-set-dictionary,
dictionary-special-dictionary, dictionary-display-more-info,
dictionary-select-strategy, dictionary-do-select-strategy,
dictionary-display-strategies, dictionary-display-strategy-line,
dictionary-set-strategy, dictionary-new-matching,
dictionary-do-matching, dictionary-display-only-match-result,
dictionary-display-match-result, dictionary-display-match-result,
dictionary-display-match-lines, dictionary-search,
dictionary-previous, dictionary-help, dictionary-match-words,
dictionary-mouse-popup-matching-words,
dictionary-popup-matching-words, dictionary-tooltip-mode,
dictionary-tooltip-mouse-event): Fix docstring
The following kind of changes were made:
- finish first line with a full stop (.)
- mention parameter in upper-case whenever possible (considering the
length constraints)
2020-12-14 10:55:35 +01:00
|
|
|
"Display the results from the current matches in REPLY without the headers."
|
2020-10-05 06:50:25 +02:00
|
|
|
(let ((number (nth 1 (dictionary-reply-list reply)))
|
|
|
|
(list (dictionary-simple-split-string (dictionary-read-answer) "\n+")))
|
|
|
|
(insert number " matching word" (if (equal number "1") "" "s")
|
|
|
|
" found\n\n")
|
|
|
|
(let ((result nil))
|
|
|
|
(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)
|
A number of docstring fixes
* lisp/net/dictionary.el (dictionary-set-server-var, dictionary-mode,
dictionary, dictionary-new-buffer, dictionary-reply-code,
dictionary-reply, dictionary-reply-list, dictionary-open-server,
dictionary-check-connection, dictionary-mode-p, dictionary-close,
dictionary-read-reply, dictionary-split-string,
dictionary-read-reply-and-split, dictionary-read-answer,
dictionary-check-reply, dictionary-coding-system,
dictionary-decode-charset, dictionary-encode-charset,
dictionary-check-initial-reply, dictionary-store-state,
dictionary-restore-state, dictionary-new-search,
dictionary-new-search-internal, dictionary-do-search,
dictionary-pre-buffer, dictionary-post-buffer,
dictionary-display-search-result, dictionary-display-word-entry,
dictionary-display-word-definition, dictionary-mark-reference,
dictionary-select-dictionary, dictionary-display-dictionarys,
dictionary-display-dictionary-line, dictionary-set-dictionary,
dictionary-special-dictionary, dictionary-display-more-info,
dictionary-select-strategy, dictionary-do-select-strategy,
dictionary-display-strategies, dictionary-display-strategy-line,
dictionary-set-strategy, dictionary-new-matching,
dictionary-do-matching, dictionary-display-only-match-result,
dictionary-display-match-result, dictionary-display-match-result,
dictionary-display-match-lines, dictionary-search,
dictionary-previous, dictionary-help, dictionary-match-words,
dictionary-mouse-popup-matching-words,
dictionary-popup-matching-words, dictionary-tooltip-mode,
dictionary-tooltip-mouse-event): Fix docstring
The following kind of changes were made:
- finish first line with a full stop (.)
- mention parameter in upper-case whenever possible (considering the
length constraints)
2020-12-14 10:55:35 +01:00
|
|
|
"Display the results in REPLY from a match operation."
|
2020-10-05 06:50:25 +02:00
|
|
|
(dictionary-pre-buffer)
|
|
|
|
|
|
|
|
(let ((number (nth 1 (dictionary-reply-list reply)))
|
|
|
|
(list (dictionary-simple-split-string (dictionary-read-answer) "\n+")))
|
|
|
|
(insert number " matching word" (if (equal number "1") "" "s")
|
|
|
|
" found\n\n")
|
|
|
|
(let ((result nil))
|
|
|
|
(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)
|
A number of docstring fixes
* lisp/net/dictionary.el (dictionary-set-server-var, dictionary-mode,
dictionary, dictionary-new-buffer, dictionary-reply-code,
dictionary-reply, dictionary-reply-list, dictionary-open-server,
dictionary-check-connection, dictionary-mode-p, dictionary-close,
dictionary-read-reply, dictionary-split-string,
dictionary-read-reply-and-split, dictionary-read-answer,
dictionary-check-reply, dictionary-coding-system,
dictionary-decode-charset, dictionary-encode-charset,
dictionary-check-initial-reply, dictionary-store-state,
dictionary-restore-state, dictionary-new-search,
dictionary-new-search-internal, dictionary-do-search,
dictionary-pre-buffer, dictionary-post-buffer,
dictionary-display-search-result, dictionary-display-word-entry,
dictionary-display-word-definition, dictionary-mark-reference,
dictionary-select-dictionary, dictionary-display-dictionarys,
dictionary-display-dictionary-line, dictionary-set-dictionary,
dictionary-special-dictionary, dictionary-display-more-info,
dictionary-select-strategy, dictionary-do-select-strategy,
dictionary-display-strategies, dictionary-display-strategy-line,
dictionary-set-strategy, dictionary-new-matching,
dictionary-do-matching, dictionary-display-only-match-result,
dictionary-display-match-result, dictionary-display-match-result,
dictionary-display-match-lines, dictionary-search,
dictionary-previous, dictionary-help, dictionary-match-words,
dictionary-mouse-popup-matching-words,
dictionary-popup-matching-words, dictionary-tooltip-mode,
dictionary-tooltip-mouse-event): Fix docstring
The following kind of changes were made:
- finish first line with a full stop (.)
- mention parameter in upper-case whenever possible (considering the
length constraints)
2020-12-14 10:55:35 +01:00
|
|
|
"Display a line for each match found in LIST."
|
2020-10-05 06:50:25 +02:00
|
|
|
(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 " ")
|
2020-10-09 06:04:35 +02:00
|
|
|
(insert-button word :type 'dictionary-link
|
2020-10-09 05:00:02 +02:00
|
|
|
'callback 'dictionary-new-search
|
|
|
|
'data (cons word dictionary)
|
2022-07-10 17:09:18 +02:00
|
|
|
'help-echo "Mouse-2 to lookup word")
|
2020-10-05 06:50:25 +02:00
|
|
|
(insert "\n")) (reverse word-list))
|
|
|
|
(insert "\n")))
|
|
|
|
list))
|
|
|
|
|
|
|
|
;; Returns a sensible default for dictionary-search:
|
|
|
|
;; - if region is active returns its contents
|
|
|
|
;; - otherwise return the word near the point
|
|
|
|
(defun dictionary-search-default ()
|
2021-02-09 20:29:54 +02:00
|
|
|
(cond
|
|
|
|
((use-region-p)
|
|
|
|
(buffer-substring-no-properties (region-beginning) (region-end)))
|
|
|
|
((car (get-char-property (point) 'data)))
|
|
|
|
(t (current-word t))))
|
2020-10-05 06:50:25 +02:00
|
|
|
|
2023-05-15 21:04:21 +03:00
|
|
|
(defun dictionary-read-dictionary-default ()
|
|
|
|
"Prompt for a dictionary name."
|
|
|
|
(read-string (if dictionary-default-dictionary
|
|
|
|
(format "Dictionary (%s): "
|
|
|
|
dictionary-default-dictionary)
|
|
|
|
"Dictionary: ")
|
|
|
|
nil nil dictionary-default-dictionary))
|
|
|
|
|
|
|
|
(defun dictionary-read-word-default (_dictionary)
|
|
|
|
"Prompt for a word to search in the dictionary."
|
|
|
|
(let ((default (dictionary-search-default)))
|
|
|
|
(read-string (format-prompt dictionary-read-word-prompt default)
|
|
|
|
nil 'dictionary-word-history default)))
|
|
|
|
|
2020-10-05 06:50:25 +02:00
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
;; User callable commands
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
|
|
|
|
;;;###autoload
|
|
|
|
(defun dictionary-search (word &optional dictionary)
|
2023-08-12 18:35:24 +03:00
|
|
|
"Search for WORD in all the known dictionaries.
|
|
|
|
Interactively, prompt for WORD, and offer the word at point as default.
|
2023-08-12 16:40:10 +02:00
|
|
|
|
2023-08-12 18:35:24 +03:00
|
|
|
Optional argument DICTIONARY means restrict the search to only
|
|
|
|
that one dictionary. Interactively, with prefix argument,
|
|
|
|
prompt for DICTIONARY."
|
2020-10-05 06:50:25 +02:00
|
|
|
(interactive
|
2023-05-15 21:04:21 +03:00
|
|
|
(let ((dict
|
|
|
|
(if current-prefix-arg
|
|
|
|
(funcall dictionary-read-dictionary-function)
|
|
|
|
dictionary-default-dictionary)))
|
|
|
|
(list (funcall dictionary-read-word-function dict) dict)))
|
2020-10-05 06:50:25 +02:00
|
|
|
(unless dictionary
|
|
|
|
(setq dictionary dictionary-default-dictionary))
|
2023-05-15 21:04:21 +03:00
|
|
|
(if dictionary-display-definition-function
|
|
|
|
(if-let ((definition (dictionary-define-word word dictionary)))
|
|
|
|
(funcall dictionary-display-definition-function word dictionary definition)
|
|
|
|
(user-error "No definition found for \"%s\"" word))
|
|
|
|
;; if called by pressing the button
|
|
|
|
(unless word
|
|
|
|
(setq word (read-string "Search word: " nil 'dictionary-word-history)))
|
|
|
|
;; just in case non-interactively called
|
|
|
|
(dictionary-new-search (cons word dictionary))))
|
2020-10-05 06:50:25 +02:00
|
|
|
|
|
|
|
;;;###autoload
|
|
|
|
(defun dictionary-lookup-definition ()
|
|
|
|
"Unconditionally lookup the word at point."
|
|
|
|
(interactive)
|
2022-10-16 11:25:17 +02:00
|
|
|
(let ((word (current-word)))
|
|
|
|
(unless word
|
|
|
|
(error "No word at point"))
|
|
|
|
(dictionary-new-search (cons word dictionary-default-dictionary))))
|
2020-10-05 06:50:25 +02:00
|
|
|
|
|
|
|
(defun dictionary-previous ()
|
A number of docstring fixes
* lisp/net/dictionary.el (dictionary-set-server-var, dictionary-mode,
dictionary, dictionary-new-buffer, dictionary-reply-code,
dictionary-reply, dictionary-reply-list, dictionary-open-server,
dictionary-check-connection, dictionary-mode-p, dictionary-close,
dictionary-read-reply, dictionary-split-string,
dictionary-read-reply-and-split, dictionary-read-answer,
dictionary-check-reply, dictionary-coding-system,
dictionary-decode-charset, dictionary-encode-charset,
dictionary-check-initial-reply, dictionary-store-state,
dictionary-restore-state, dictionary-new-search,
dictionary-new-search-internal, dictionary-do-search,
dictionary-pre-buffer, dictionary-post-buffer,
dictionary-display-search-result, dictionary-display-word-entry,
dictionary-display-word-definition, dictionary-mark-reference,
dictionary-select-dictionary, dictionary-display-dictionarys,
dictionary-display-dictionary-line, dictionary-set-dictionary,
dictionary-special-dictionary, dictionary-display-more-info,
dictionary-select-strategy, dictionary-do-select-strategy,
dictionary-display-strategies, dictionary-display-strategy-line,
dictionary-set-strategy, dictionary-new-matching,
dictionary-do-matching, dictionary-display-only-match-result,
dictionary-display-match-result, dictionary-display-match-result,
dictionary-display-match-lines, dictionary-search,
dictionary-previous, dictionary-help, dictionary-match-words,
dictionary-mouse-popup-matching-words,
dictionary-popup-matching-words, dictionary-tooltip-mode,
dictionary-tooltip-mouse-event): Fix docstring
The following kind of changes were made:
- finish first line with a full stop (.)
- mention parameter in upper-case whenever possible (considering the
length constraints)
2020-12-14 10:55:35 +01:00
|
|
|
"Go to the previous location in the current buffer."
|
2020-10-05 06:50:25 +02:00
|
|
|
(interactive)
|
|
|
|
(unless (dictionary-mode-p)
|
|
|
|
(error "Current buffer is no dictionary buffer"))
|
|
|
|
(dictionary-restore-state))
|
|
|
|
|
|
|
|
(defun dictionary-help ()
|
A number of docstring fixes
* lisp/net/dictionary.el (dictionary-set-server-var, dictionary-mode,
dictionary, dictionary-new-buffer, dictionary-reply-code,
dictionary-reply, dictionary-reply-list, dictionary-open-server,
dictionary-check-connection, dictionary-mode-p, dictionary-close,
dictionary-read-reply, dictionary-split-string,
dictionary-read-reply-and-split, dictionary-read-answer,
dictionary-check-reply, dictionary-coding-system,
dictionary-decode-charset, dictionary-encode-charset,
dictionary-check-initial-reply, dictionary-store-state,
dictionary-restore-state, dictionary-new-search,
dictionary-new-search-internal, dictionary-do-search,
dictionary-pre-buffer, dictionary-post-buffer,
dictionary-display-search-result, dictionary-display-word-entry,
dictionary-display-word-definition, dictionary-mark-reference,
dictionary-select-dictionary, dictionary-display-dictionarys,
dictionary-display-dictionary-line, dictionary-set-dictionary,
dictionary-special-dictionary, dictionary-display-more-info,
dictionary-select-strategy, dictionary-do-select-strategy,
dictionary-display-strategies, dictionary-display-strategy-line,
dictionary-set-strategy, dictionary-new-matching,
dictionary-do-matching, dictionary-display-only-match-result,
dictionary-display-match-result, dictionary-display-match-result,
dictionary-display-match-lines, dictionary-search,
dictionary-previous, dictionary-help, dictionary-match-words,
dictionary-mouse-popup-matching-words,
dictionary-popup-matching-words, dictionary-tooltip-mode,
dictionary-tooltip-mouse-event): Fix docstring
The following kind of changes were made:
- finish first line with a full stop (.)
- mention parameter in upper-case whenever possible (considering the
length constraints)
2020-12-14 10:55:35 +01:00
|
|
|
"Display a little help."
|
2022-07-21 08:56:59 +02:00
|
|
|
(declare (obsolete describe-mode "29.1"))
|
|
|
|
(interactive nil dictionary-mode)
|
2020-10-05 06:50:25 +02:00
|
|
|
(describe-function 'dictionary-mode))
|
|
|
|
|
|
|
|
;;;###autoload
|
2021-03-08 10:11:22 -05:00
|
|
|
(defun dictionary-match-words (&optional pattern &rest _ignored)
|
A number of docstring fixes
* lisp/net/dictionary.el (dictionary-set-server-var, dictionary-mode,
dictionary, dictionary-new-buffer, dictionary-reply-code,
dictionary-reply, dictionary-reply-list, dictionary-open-server,
dictionary-check-connection, dictionary-mode-p, dictionary-close,
dictionary-read-reply, dictionary-split-string,
dictionary-read-reply-and-split, dictionary-read-answer,
dictionary-check-reply, dictionary-coding-system,
dictionary-decode-charset, dictionary-encode-charset,
dictionary-check-initial-reply, dictionary-store-state,
dictionary-restore-state, dictionary-new-search,
dictionary-new-search-internal, dictionary-do-search,
dictionary-pre-buffer, dictionary-post-buffer,
dictionary-display-search-result, dictionary-display-word-entry,
dictionary-display-word-definition, dictionary-mark-reference,
dictionary-select-dictionary, dictionary-display-dictionarys,
dictionary-display-dictionary-line, dictionary-set-dictionary,
dictionary-special-dictionary, dictionary-display-more-info,
dictionary-select-strategy, dictionary-do-select-strategy,
dictionary-display-strategies, dictionary-display-strategy-line,
dictionary-set-strategy, dictionary-new-matching,
dictionary-do-matching, dictionary-display-only-match-result,
dictionary-display-match-result, dictionary-display-match-result,
dictionary-display-match-lines, dictionary-search,
dictionary-previous, dictionary-help, dictionary-match-words,
dictionary-mouse-popup-matching-words,
dictionary-popup-matching-words, dictionary-tooltip-mode,
dictionary-tooltip-mouse-event): Fix docstring
The following kind of changes were made:
- finish first line with a full stop (.)
- mention parameter in upper-case whenever possible (considering the
length constraints)
2020-12-14 10:55:35 +01:00
|
|
|
"Search PATTERN in current default dictionary using default strategy."
|
2020-10-05 06:50:25 +02:00
|
|
|
(interactive)
|
|
|
|
;; can't use interactive because of mouse events
|
|
|
|
(or pattern
|
2020-11-08 16:08:07 +01:00
|
|
|
(setq pattern (read-string "Search pattern: "
|
|
|
|
nil 'dictionary-word-history)))
|
2020-10-05 06:50:25 +02:00
|
|
|
(dictionary-new-matching pattern))
|
|
|
|
|
|
|
|
;;;###autoload
|
|
|
|
(defun dictionary-mouse-popup-matching-words (event)
|
A number of docstring fixes
* lisp/net/dictionary.el (dictionary-set-server-var, dictionary-mode,
dictionary, dictionary-new-buffer, dictionary-reply-code,
dictionary-reply, dictionary-reply-list, dictionary-open-server,
dictionary-check-connection, dictionary-mode-p, dictionary-close,
dictionary-read-reply, dictionary-split-string,
dictionary-read-reply-and-split, dictionary-read-answer,
dictionary-check-reply, dictionary-coding-system,
dictionary-decode-charset, dictionary-encode-charset,
dictionary-check-initial-reply, dictionary-store-state,
dictionary-restore-state, dictionary-new-search,
dictionary-new-search-internal, dictionary-do-search,
dictionary-pre-buffer, dictionary-post-buffer,
dictionary-display-search-result, dictionary-display-word-entry,
dictionary-display-word-definition, dictionary-mark-reference,
dictionary-select-dictionary, dictionary-display-dictionarys,
dictionary-display-dictionary-line, dictionary-set-dictionary,
dictionary-special-dictionary, dictionary-display-more-info,
dictionary-select-strategy, dictionary-do-select-strategy,
dictionary-display-strategies, dictionary-display-strategy-line,
dictionary-set-strategy, dictionary-new-matching,
dictionary-do-matching, dictionary-display-only-match-result,
dictionary-display-match-result, dictionary-display-match-result,
dictionary-display-match-lines, dictionary-search,
dictionary-previous, dictionary-help, dictionary-match-words,
dictionary-mouse-popup-matching-words,
dictionary-popup-matching-words, dictionary-tooltip-mode,
dictionary-tooltip-mouse-event): Fix docstring
The following kind of changes were made:
- finish first line with a full stop (.)
- mention parameter in upper-case whenever possible (considering the
length constraints)
2020-12-14 10:55:35 +01:00
|
|
|
"Display entries matching the word at the cursor retrieved using EVENT."
|
2020-10-05 06:50:25 +02:00
|
|
|
(interactive "e")
|
|
|
|
(let ((word (save-window-excursion
|
|
|
|
(save-excursion
|
|
|
|
(mouse-set-point event)
|
|
|
|
(current-word)))))
|
|
|
|
(dictionary-popup-matching-words word)))
|
|
|
|
|
|
|
|
;;;###autoload
|
|
|
|
(defun dictionary-popup-matching-words (&optional word)
|
A number of docstring fixes
* lisp/net/dictionary.el (dictionary-set-server-var, dictionary-mode,
dictionary, dictionary-new-buffer, dictionary-reply-code,
dictionary-reply, dictionary-reply-list, dictionary-open-server,
dictionary-check-connection, dictionary-mode-p, dictionary-close,
dictionary-read-reply, dictionary-split-string,
dictionary-read-reply-and-split, dictionary-read-answer,
dictionary-check-reply, dictionary-coding-system,
dictionary-decode-charset, dictionary-encode-charset,
dictionary-check-initial-reply, dictionary-store-state,
dictionary-restore-state, dictionary-new-search,
dictionary-new-search-internal, dictionary-do-search,
dictionary-pre-buffer, dictionary-post-buffer,
dictionary-display-search-result, dictionary-display-word-entry,
dictionary-display-word-definition, dictionary-mark-reference,
dictionary-select-dictionary, dictionary-display-dictionarys,
dictionary-display-dictionary-line, dictionary-set-dictionary,
dictionary-special-dictionary, dictionary-display-more-info,
dictionary-select-strategy, dictionary-do-select-strategy,
dictionary-display-strategies, dictionary-display-strategy-line,
dictionary-set-strategy, dictionary-new-matching,
dictionary-do-matching, dictionary-display-only-match-result,
dictionary-display-match-result, dictionary-display-match-result,
dictionary-display-match-lines, dictionary-search,
dictionary-previous, dictionary-help, dictionary-match-words,
dictionary-mouse-popup-matching-words,
dictionary-popup-matching-words, dictionary-tooltip-mode,
dictionary-tooltip-mouse-event): Fix docstring
The following kind of changes were made:
- finish first line with a full stop (.)
- mention parameter in upper-case whenever possible (considering the
length constraints)
2020-12-14 10:55:35 +01:00
|
|
|
"Display entries matching WORD or the current word if not given."
|
2020-10-05 06:50:25 +02:00
|
|
|
(interactive)
|
2020-11-19 21:45:25 +01:00
|
|
|
(dictionary-do-matching (or word (current-word) (error "Nothing to search for"))
|
2020-10-05 06:50:25 +02:00
|
|
|
dictionary-default-dictionary
|
|
|
|
dictionary-default-popup-strategy
|
|
|
|
'dictionary-process-popup-replies))
|
|
|
|
|
2020-11-19 21:39:10 +01:00
|
|
|
(defun dictionary-process-popup-replies (&ignore)
|
|
|
|
(let ((list (dictionary-simple-split-string (dictionary-read-answer) "\n+")))
|
2020-10-05 06:50:25 +02:00
|
|
|
|
|
|
|
(let ((result (mapcar (lambda (item)
|
|
|
|
(let* ((list (dictionary-split-string item))
|
|
|
|
(dictionary (car list))
|
|
|
|
(word (dictionary-decode-charset
|
|
|
|
(cadr list) dictionary)))
|
|
|
|
(message word)
|
|
|
|
(if (equal word "")
|
|
|
|
[ "-" nil nil]
|
|
|
|
(vector (concat "[" dictionary "] " word)
|
|
|
|
`(dictionary-new-search
|
|
|
|
'(,word . ,dictionary))
|
|
|
|
t ))))
|
|
|
|
|
|
|
|
list)))
|
2020-11-19 21:39:10 +01:00
|
|
|
(easy-menu-define dictionary-mode-map-menu dictionary-mode-map
|
|
|
|
"Menu used for displaying dictionary popup"
|
|
|
|
(cons "Matching words"
|
|
|
|
`(,@result)))
|
|
|
|
(popup-menu dictionary-mode-map-menu))))
|
2020-10-05 06:50:25 +02:00
|
|
|
|
|
|
|
;;; Tooltip support
|
|
|
|
|
Fix typos
* doc/lispref/display.texi (Size of Displayed Text):
* doc/lispref/windows.texi (Buffer Display Action Functions):
* etc/NEWS:
* etc/ORG-NEWS (Org-Attach has been refactored and extended):
* lisp/battery.el (display-battery-mode, battery--upower-subsribe):
* lisp/calendar/parse-time.el:
* lisp/dired-x.el:
* lisp/emacs-lisp/chart.el (chart-sequece, chart-bar-quickie):
* lisp/emacs-lisp/eldoc.el (eldoc-echo-area-use-multiline-p)
(eldoc-documentation-strategy):
* lisp/emacs-lisp/pcase.el (pcase--split-pred, pcase--u1):
* lisp/gnus/gnus-search.el (gnus-search-expandable-keys)
(gnus-search-parse-query, gnus-search-query-return-string)
(gnus-search-imap, gnus-search-imap-search-command)
(gnus-search-transform-expression):
* lisp/gnus/nnselect.el:
* lisp/isearch.el (isearch-lazy-count-format):
* lisp/mh-e/mh-show.el (mh-show-msg):
* lisp/net/dictionary-connection.el (dictionary-connection-open):
* lisp/net/dictionary.el (dictionary-default-popup-strategy)
(dictionary, dictionary-split-string, dictionary-do-select-dictionary)
(dictionary-display-dictionarys, dictionary-search)
(dictionary-tooltip-mode):
* lisp/net/eudcb-macos-contacts.el (eudc-macos-contacts-set-server):
* lisp/net/mailcap.el (mailcap-mime-data):
* lisp/net/tramp-smb.el (tramp-smb-maybe-open-connection):
* lisp/nxml/nxml-mode.el (nxml-mode):
* lisp/progmodes/cc-engine.el:
* lisp/progmodes/cperl-mode.el (cperl-mode)
(cperl-fontify-syntaxically):
* lisp/progmodes/flymake.el (flymake-diagnostic-functions):
* lisp/progmodes/verilog-mode.el (verilog--supressed-warnings)
(verilog-preprocess):
* lisp/simple.el (self-insert-uses-region-functions):
* lisp/textmodes/bibtex.el (bibtex-copy-summary-as-kill):
* lisp/textmodes/texnfo-upd.el (texinfo-insert-master-menu-list):
* src/dispnew.c:
* src/font.c (Ffont_get):
* src/indent.c (compute_motion):
* src/process.c (init_process_emacs):
* src/w32fns.c (deliver_wm_chars):
* test/lisp/jsonrpc-tests.el (deferred-action-complex-tests):
Fix typos in documentation, comments, and internal identifiers.
2021-02-18 16:41:36 +01:00
|
|
|
;; Add a mode indicator named "Dict"
|
2020-10-05 06:50:25 +02:00
|
|
|
(defvar dictionary-tooltip-mode
|
|
|
|
nil
|
Fix typos
* doc/lispref/display.texi (Size of Displayed Text):
* doc/lispref/windows.texi (Buffer Display Action Functions):
* etc/NEWS:
* etc/ORG-NEWS (Org-Attach has been refactored and extended):
* lisp/battery.el (display-battery-mode, battery--upower-subsribe):
* lisp/calendar/parse-time.el:
* lisp/dired-x.el:
* lisp/emacs-lisp/chart.el (chart-sequece, chart-bar-quickie):
* lisp/emacs-lisp/eldoc.el (eldoc-echo-area-use-multiline-p)
(eldoc-documentation-strategy):
* lisp/emacs-lisp/pcase.el (pcase--split-pred, pcase--u1):
* lisp/gnus/gnus-search.el (gnus-search-expandable-keys)
(gnus-search-parse-query, gnus-search-query-return-string)
(gnus-search-imap, gnus-search-imap-search-command)
(gnus-search-transform-expression):
* lisp/gnus/nnselect.el:
* lisp/isearch.el (isearch-lazy-count-format):
* lisp/mh-e/mh-show.el (mh-show-msg):
* lisp/net/dictionary-connection.el (dictionary-connection-open):
* lisp/net/dictionary.el (dictionary-default-popup-strategy)
(dictionary, dictionary-split-string, dictionary-do-select-dictionary)
(dictionary-display-dictionarys, dictionary-search)
(dictionary-tooltip-mode):
* lisp/net/eudcb-macos-contacts.el (eudc-macos-contacts-set-server):
* lisp/net/mailcap.el (mailcap-mime-data):
* lisp/net/tramp-smb.el (tramp-smb-maybe-open-connection):
* lisp/nxml/nxml-mode.el (nxml-mode):
* lisp/progmodes/cc-engine.el:
* lisp/progmodes/cperl-mode.el (cperl-mode)
(cperl-fontify-syntaxically):
* lisp/progmodes/flymake.el (flymake-diagnostic-functions):
* lisp/progmodes/verilog-mode.el (verilog--supressed-warnings)
(verilog-preprocess):
* lisp/simple.el (self-insert-uses-region-functions):
* lisp/textmodes/bibtex.el (bibtex-copy-summary-as-kill):
* lisp/textmodes/texnfo-upd.el (texinfo-insert-master-menu-list):
* src/dispnew.c:
* src/font.c (Ffont_get):
* src/indent.c (compute_motion):
* src/process.c (init_process_emacs):
* src/w32fns.c (deliver_wm_chars):
* test/lisp/jsonrpc-tests.el (deferred-action-complex-tests):
Fix typos in documentation, comments, and internal identifiers.
2021-02-18 16:41:36 +01:00
|
|
|
"Indicates whether the dictionary tooltip mode is active.")
|
2020-10-05 06:50:25 +02:00
|
|
|
(nconc minor-mode-alist '((dictionary-tooltip-mode " Dict")))
|
|
|
|
|
|
|
|
(defcustom dictionary-tooltip-dictionary
|
|
|
|
nil
|
Various doc fixes in dictionary.el
* lisp/net/dictionary.el (dictionary-set-server-var)
(dictionary-server, dictionary-port)
(dictionary-default-dictionary)
(dictionary-default-popup-strategy, dictionary-proxy-server)
(dictionary-proxy-port, dictionary-description-open-delimiter)
(dictionary-description-close-delimiter)
(dictionary-window-configuration, dictionary-selected-window)
(dictionary-position-stack, dictionary-data-stack)
(dictionary-positions, dictionary-current-data)
(dictionary-connection, dictionary-instances)
(dictionary-color-support, dictionary-word-history)
(dictionary-mode, dictionary, dictionary-check-connection)
(dictionary-mode-p, dictionary-send-command)
(dictionary-read-reply-and-split, dictionary-check-reply)
(dictionary-check-initial-reply, dictionary-store-state)
(dictionary-store-positions, dictionary-new-search)
(dictionary-new-search-internal, dictionary-do-search)
(dictionary-display-search-result)
(dictionary-display-word-definition)
(dictionary-special-dictionary, dictionary-set-strategy)
(dictionary-tooltip-dictionary, dictionary-switch-tooltip-mode)
(dictionary-tooltip-mode, global-dictionary-tooltip-mode): Doc fixes
to adhere to our conventions.
2021-02-07 15:53:46 +01:00
|
|
|
"This dictionary to lookup words for tooltips."
|
2020-10-05 06:50:25 +02:00
|
|
|
:group 'dictionary
|
2020-10-08 19:30:12 +02:00
|
|
|
:type '(choice (const :tag "None" nil) string)
|
|
|
|
:version "28.1")
|
2020-10-05 06:50:25 +02:00
|
|
|
|
|
|
|
(defun dictionary-definition (word &optional dictionary)
|
|
|
|
(unwind-protect
|
|
|
|
(let ((dictionary (or dictionary dictionary-default-dictionary)))
|
|
|
|
(dictionary-do-search word dictionary 'dictionary-read-definition t))
|
|
|
|
nil))
|
|
|
|
|
2020-11-19 21:39:10 +01:00
|
|
|
(defun dictionary-read-definition (&ignore)
|
2020-10-05 06:50:25 +02:00
|
|
|
(let ((list (dictionary-simple-split-string (dictionary-read-answer) "\n+")))
|
2021-03-08 10:11:22 -05:00
|
|
|
(mapconcat #'identity (cdr list) "\n")))
|
2020-10-05 06:50:25 +02:00
|
|
|
|
2020-10-10 07:04:27 +02:00
|
|
|
;;; Tooltip support for GNU Emacs
|
2020-10-05 06:50:25 +02:00
|
|
|
(defvar global-dictionary-tooltip-mode
|
|
|
|
nil)
|
|
|
|
|
2020-10-10 07:04:27 +02:00
|
|
|
(defun dictionary-word-at-mouse-event (event)
|
|
|
|
(with-current-buffer (tooltip-event-buffer event)
|
|
|
|
(let ((point (posn-point (event-end event))))
|
|
|
|
(if (use-region-p)
|
|
|
|
(when (and (<= (region-beginning) point) (<= point (region-end)))
|
|
|
|
(buffer-substring (region-beginning) (region-end)))
|
|
|
|
(save-excursion
|
|
|
|
(goto-char point)
|
|
|
|
(current-word))))))
|
|
|
|
|
2020-11-19 08:25:42 +01:00
|
|
|
(defvar dictionary-tooltip-mouse-event nil
|
A number of docstring fixes
* lisp/net/dictionary.el (dictionary-set-server-var, dictionary-mode,
dictionary, dictionary-new-buffer, dictionary-reply-code,
dictionary-reply, dictionary-reply-list, dictionary-open-server,
dictionary-check-connection, dictionary-mode-p, dictionary-close,
dictionary-read-reply, dictionary-split-string,
dictionary-read-reply-and-split, dictionary-read-answer,
dictionary-check-reply, dictionary-coding-system,
dictionary-decode-charset, dictionary-encode-charset,
dictionary-check-initial-reply, dictionary-store-state,
dictionary-restore-state, dictionary-new-search,
dictionary-new-search-internal, dictionary-do-search,
dictionary-pre-buffer, dictionary-post-buffer,
dictionary-display-search-result, dictionary-display-word-entry,
dictionary-display-word-definition, dictionary-mark-reference,
dictionary-select-dictionary, dictionary-display-dictionarys,
dictionary-display-dictionary-line, dictionary-set-dictionary,
dictionary-special-dictionary, dictionary-display-more-info,
dictionary-select-strategy, dictionary-do-select-strategy,
dictionary-display-strategies, dictionary-display-strategy-line,
dictionary-set-strategy, dictionary-new-matching,
dictionary-do-matching, dictionary-display-only-match-result,
dictionary-display-match-result, dictionary-display-match-result,
dictionary-display-match-lines, dictionary-search,
dictionary-previous, dictionary-help, dictionary-match-words,
dictionary-mouse-popup-matching-words,
dictionary-popup-matching-words, dictionary-tooltip-mode,
dictionary-tooltip-mouse-event): Fix docstring
The following kind of changes were made:
- finish first line with a full stop (.)
- mention parameter in upper-case whenever possible (considering the
length constraints)
2020-12-14 10:55:35 +01:00
|
|
|
"Event that triggered the tooltip mode.")
|
2020-11-19 08:25:42 +01:00
|
|
|
|
2020-11-19 21:39:10 +01:00
|
|
|
(defun dictionary-display-tooltip (&ignore)
|
2020-10-05 06:50:25 +02:00
|
|
|
"Search the current word in the `dictionary-tooltip-dictionary'."
|
|
|
|
(interactive "e")
|
2020-10-10 07:04:27 +02:00
|
|
|
(if (and dictionary-tooltip-mode dictionary-tooltip-dictionary)
|
|
|
|
(let ((word (dictionary-word-at-mouse-event dictionary-tooltip-mouse-event)))
|
|
|
|
(if word
|
|
|
|
(let ((definition
|
|
|
|
(dictionary-definition word dictionary-tooltip-dictionary)))
|
|
|
|
(if definition
|
|
|
|
(tooltip-show (dictionary-decode-charset definition
|
|
|
|
dictionary-tooltip-dictionary)))))
|
|
|
|
t)
|
2020-10-05 06:50:25 +02:00
|
|
|
nil))
|
|
|
|
|
2020-10-10 07:04:27 +02:00
|
|
|
(defun dictionary-tooltip-track-mouse (event)
|
|
|
|
"Called whenever a dictionary tooltip display is about to be triggered."
|
|
|
|
(interactive "e")
|
|
|
|
(tooltip-hide)
|
|
|
|
(when dictionary-tooltip-mode
|
|
|
|
(setq dictionary-tooltip-mouse-event (copy-sequence event))
|
|
|
|
(tooltip-start-delayed-tip)))
|
|
|
|
|
|
|
|
(defun dictionary-switch-tooltip-mode (on)
|
|
|
|
"Turn off or on support for the dictionary tooltip mode.
|
|
|
|
|
|
|
|
It is normally internally called with 1 to enable support for the
|
2021-09-14 08:43:18 +02:00
|
|
|
tooltip mode. The hook function will check the value of the
|
|
|
|
variable `dictionary-tooltip-mode' to decide if some action must be
|
|
|
|
taken. When disabling the tooltip mode the value of this variable
|
Various doc fixes in dictionary.el
* lisp/net/dictionary.el (dictionary-set-server-var)
(dictionary-server, dictionary-port)
(dictionary-default-dictionary)
(dictionary-default-popup-strategy, dictionary-proxy-server)
(dictionary-proxy-port, dictionary-description-open-delimiter)
(dictionary-description-close-delimiter)
(dictionary-window-configuration, dictionary-selected-window)
(dictionary-position-stack, dictionary-data-stack)
(dictionary-positions, dictionary-current-data)
(dictionary-connection, dictionary-instances)
(dictionary-color-support, dictionary-word-history)
(dictionary-mode, dictionary, dictionary-check-connection)
(dictionary-mode-p, dictionary-send-command)
(dictionary-read-reply-and-split, dictionary-check-reply)
(dictionary-check-initial-reply, dictionary-store-state)
(dictionary-store-positions, dictionary-new-search)
(dictionary-new-search-internal, dictionary-do-search)
(dictionary-display-search-result)
(dictionary-display-word-definition)
(dictionary-special-dictionary, dictionary-set-strategy)
(dictionary-tooltip-dictionary, dictionary-switch-tooltip-mode)
(dictionary-tooltip-mode, global-dictionary-tooltip-mode): Doc fixes
to adhere to our conventions.
2021-02-07 15:53:46 +01:00
|
|
|
will be set to nil."
|
2020-10-10 07:04:27 +02:00
|
|
|
(tooltip-mode on)
|
|
|
|
(if on
|
2021-03-08 10:11:22 -05:00
|
|
|
(add-hook 'tooltip-functions #'dictionary-display-tooltip)
|
|
|
|
(remove-hook 'tooltip-functions #'dictionary-display-tooltip)))
|
2020-10-10 07:04:27 +02:00
|
|
|
|
2020-10-05 06:50:25 +02:00
|
|
|
;;;###autoload
|
|
|
|
(defun dictionary-tooltip-mode (&optional arg)
|
2020-10-10 07:04:27 +02:00
|
|
|
"Display tooltips for the current word.
|
|
|
|
|
|
|
|
This function can be used to enable or disable the tooltip mode
|
Various doc fixes in dictionary.el
* lisp/net/dictionary.el (dictionary-set-server-var)
(dictionary-server, dictionary-port)
(dictionary-default-dictionary)
(dictionary-default-popup-strategy, dictionary-proxy-server)
(dictionary-proxy-port, dictionary-description-open-delimiter)
(dictionary-description-close-delimiter)
(dictionary-window-configuration, dictionary-selected-window)
(dictionary-position-stack, dictionary-data-stack)
(dictionary-positions, dictionary-current-data)
(dictionary-connection, dictionary-instances)
(dictionary-color-support, dictionary-word-history)
(dictionary-mode, dictionary, dictionary-check-connection)
(dictionary-mode-p, dictionary-send-command)
(dictionary-read-reply-and-split, dictionary-check-reply)
(dictionary-check-initial-reply, dictionary-store-state)
(dictionary-store-positions, dictionary-new-search)
(dictionary-new-search-internal, dictionary-do-search)
(dictionary-display-search-result)
(dictionary-display-word-definition)
(dictionary-special-dictionary, dictionary-set-strategy)
(dictionary-tooltip-dictionary, dictionary-switch-tooltip-mode)
(dictionary-tooltip-mode, global-dictionary-tooltip-mode): Doc fixes
to adhere to our conventions.
2021-02-07 15:53:46 +01:00
|
|
|
for the current buffer (based on ARG). If global-tooltip-mode is
|
|
|
|
active it will overwrite that mode for the current buffer."
|
2020-10-05 06:50:25 +02:00
|
|
|
(interactive "P")
|
|
|
|
(require 'tooltip)
|
|
|
|
(let ((on (if arg
|
2020-10-05 07:06:30 +02:00
|
|
|
(> (prefix-numeric-value arg) 0)
|
|
|
|
(not dictionary-tooltip-mode))))
|
2020-12-14 09:40:33 +01:00
|
|
|
(setq-local dictionary-tooltip-mode on)
|
|
|
|
(setq-local track-mouse on)
|
2020-10-10 07:04:27 +02:00
|
|
|
(make-local-variable 'dictionary-tooltip-mouse-event)
|
|
|
|
(dictionary-switch-tooltip-mode 1)
|
|
|
|
(if on
|
|
|
|
(local-set-key [mouse-movement] 'dictionary-tooltip-track-mouse)
|
|
|
|
(local-set-key [mouse-movement] 'ignore))
|
|
|
|
on))
|
2020-10-05 06:50:25 +02:00
|
|
|
|
|
|
|
;;;###autoload
|
|
|
|
(defun global-dictionary-tooltip-mode (&optional arg)
|
2021-09-14 08:43:18 +02:00
|
|
|
"Enable/disable `dictionary-tooltip-mode' for all buffers.
|
2020-10-10 07:04:27 +02:00
|
|
|
|
2021-09-14 08:43:18 +02:00
|
|
|
Internally it provides a default for the `dictionary-tooltip-mode'.
|
|
|
|
It can be overwritten for each buffer using `dictionary-tooltip-mode'.
|
2020-10-10 07:04:27 +02:00
|
|
|
|
|
|
|
Note: (global-dictionary-tooltip-mode 0) will not disable the mode
|
Various doc fixes in dictionary.el
* lisp/net/dictionary.el (dictionary-set-server-var)
(dictionary-server, dictionary-port)
(dictionary-default-dictionary)
(dictionary-default-popup-strategy, dictionary-proxy-server)
(dictionary-proxy-port, dictionary-description-open-delimiter)
(dictionary-description-close-delimiter)
(dictionary-window-configuration, dictionary-selected-window)
(dictionary-position-stack, dictionary-data-stack)
(dictionary-positions, dictionary-current-data)
(dictionary-connection, dictionary-instances)
(dictionary-color-support, dictionary-word-history)
(dictionary-mode, dictionary, dictionary-check-connection)
(dictionary-mode-p, dictionary-send-command)
(dictionary-read-reply-and-split, dictionary-check-reply)
(dictionary-check-initial-reply, dictionary-store-state)
(dictionary-store-positions, dictionary-new-search)
(dictionary-new-search-internal, dictionary-do-search)
(dictionary-display-search-result)
(dictionary-display-word-definition)
(dictionary-special-dictionary, dictionary-set-strategy)
(dictionary-tooltip-dictionary, dictionary-switch-tooltip-mode)
(dictionary-tooltip-mode, global-dictionary-tooltip-mode): Doc fixes
to adhere to our conventions.
2021-02-07 15:53:46 +01:00
|
|
|
any buffer where (dictionary-tooltip-mode 1) has been called."
|
2020-10-05 06:50:25 +02:00
|
|
|
(interactive "P")
|
|
|
|
(require 'tooltip)
|
2020-10-10 07:04:27 +02:00
|
|
|
(let ((on (if arg (> (prefix-numeric-value arg) 0)
|
|
|
|
(not global-dictionary-tooltip-mode))))
|
2020-10-05 06:50:25 +02:00
|
|
|
(setq global-dictionary-tooltip-mode on)
|
|
|
|
(setq-default dictionary-tooltip-mode on)
|
2020-10-10 07:04:27 +02:00
|
|
|
(make-local-variable 'dictionary-tooltip-mouse-event)
|
|
|
|
(setq-default track-mouse on)
|
|
|
|
(dictionary-switch-tooltip-mode 1)
|
2021-03-08 10:11:22 -05:00
|
|
|
(global-set-key [mouse-movement]
|
|
|
|
(if on #'dictionary-tooltip-track-mouse #'ignore))
|
2020-10-10 07:04:27 +02:00
|
|
|
on))
|
2020-10-05 06:50:25 +02:00
|
|
|
|
2021-09-12 20:32:02 +03:00
|
|
|
;;; Context menu support
|
|
|
|
|
|
|
|
(defun dictionary-search-word-at-mouse (event)
|
|
|
|
(interactive "e")
|
|
|
|
(let ((word (save-window-excursion
|
|
|
|
(save-excursion
|
|
|
|
(mouse-set-point event)
|
|
|
|
(current-word)))))
|
|
|
|
(dictionary-search word)))
|
|
|
|
|
2021-09-29 10:19:22 +03:00
|
|
|
;;;###autoload
|
2022-01-15 20:58:31 +02:00
|
|
|
(defun dictionary-context-menu (menu click)
|
2021-09-29 10:19:22 +03:00
|
|
|
"Populate MENU with dictionary commands at CLICK.
|
|
|
|
When you add this function to `context-menu-functions',
|
|
|
|
the context menu will contain an item that searches
|
|
|
|
the word at mouse click."
|
2021-09-12 20:32:02 +03:00
|
|
|
(when (thing-at-mouse click 'word)
|
2021-10-02 22:22:41 +03:00
|
|
|
(define-key-after menu [dictionary-separator] menu-bar-separator
|
|
|
|
'middle-separator)
|
|
|
|
(define-key-after menu [dictionary-search-word-at-mouse]
|
2021-09-12 20:32:02 +03:00
|
|
|
'(menu-item "Dictionary Search" dictionary-search-word-at-mouse
|
2021-10-02 22:22:41 +03:00
|
|
|
:help "Search the word at mouse click in dictionary")
|
|
|
|
'dictionary-separator))
|
2021-09-12 20:32:02 +03:00
|
|
|
menu)
|
|
|
|
|
2023-05-15 21:04:21 +03:00
|
|
|
(defun dictionary-define-word (word dictionary)
|
|
|
|
"Return the definition of WORD in DICTIONARY, or nil if not found."
|
|
|
|
(dictionary-send-command
|
|
|
|
(format "define %s \"%s\"" dictionary word))
|
|
|
|
(when (and (= (read (dictionary-read-reply)) 150)
|
|
|
|
(= (read (dictionary-read-reply)) 151))
|
|
|
|
(dictionary-read-answer)))
|
|
|
|
|
|
|
|
(defun dictionary-match-word (word &rest _)
|
|
|
|
"Return dictionary matches for WORD as a list of strings.
|
|
|
|
Further arguments are currently ignored."
|
|
|
|
(unless (string-empty-p word)
|
|
|
|
(if (string= (car dictionary--last-match) word)
|
|
|
|
(cdr dictionary--last-match)
|
|
|
|
(dictionary-send-command
|
|
|
|
(format "match %s %s \"%s\""
|
|
|
|
dictionary-default-dictionary
|
|
|
|
dictionary-default-strategy
|
|
|
|
word))
|
|
|
|
(when (and (= (read (dictionary-read-reply)) 152))
|
|
|
|
(with-temp-buffer
|
|
|
|
(insert (dictionary-read-answer))
|
|
|
|
(goto-char (point-min))
|
|
|
|
(let ((result nil))
|
|
|
|
(while (not (eobp))
|
|
|
|
(search-forward " " nil t)
|
|
|
|
(push (read (current-buffer)) result)
|
|
|
|
(search-forward "\n" nil t))
|
|
|
|
(setq result (reverse result))
|
|
|
|
(setq dictionary--last-match (cons word result))
|
|
|
|
result))))))
|
|
|
|
|
|
|
|
(defun dictionary-completing-read-word (dictionary)
|
|
|
|
"Prompt for a word with completion based on matches in DICTIONARY."
|
|
|
|
(let* ((completion-ignore-case t)
|
|
|
|
(dictionary-default-dictionary dictionary)
|
|
|
|
(word-at-point (thing-at-point 'word t))
|
|
|
|
(default (dictionary-match-word word-at-point)))
|
|
|
|
(completing-read (format-prompt dictionary-read-word-prompt default)
|
|
|
|
(external-completion-table 'dictionary-definition
|
|
|
|
#'dictionary-match-word)
|
|
|
|
nil t nil 'dictionary-word-history default t)))
|
|
|
|
|
|
|
|
(defun dictionary-dictionaries ()
|
|
|
|
"Return the list of dictionaries the server supports."
|
|
|
|
(dictionary-send-command "show db")
|
|
|
|
(when (and (= (read (dictionary-read-reply)) 110))
|
|
|
|
(with-temp-buffer
|
|
|
|
(insert (dictionary-read-answer))
|
|
|
|
(goto-char (point-min))
|
|
|
|
(let ((result '(("!" . "First matching dictionary")
|
|
|
|
("*" . "All dictionaries"))))
|
|
|
|
(while (not (eobp))
|
|
|
|
(push (cons (buffer-substring
|
|
|
|
(search-forward "\n" nil t)
|
|
|
|
(1- (search-forward " " nil t)))
|
|
|
|
(read (current-buffer)))
|
|
|
|
result))
|
|
|
|
(reverse result)))))
|
|
|
|
|
|
|
|
(defun dictionary-completing-read-dictionary ()
|
|
|
|
"Prompt for a dictionary the server supports."
|
|
|
|
(let* ((dicts (dictionary-dictionaries))
|
|
|
|
(len (apply #'max (mapcar #'length (mapcar #'car dicts))))
|
|
|
|
(completion-extra-properties
|
|
|
|
(list :annotation-function
|
|
|
|
(lambda (key)
|
|
|
|
(concat (make-string (1+ (- len (length key))) ?\s)
|
|
|
|
(alist-get key dicts nil nil #'string=))))))
|
|
|
|
(completing-read (format-prompt "Select dictionary"
|
|
|
|
dictionary-default-dictionary)
|
|
|
|
dicts nil t nil nil dictionary-default-dictionary)))
|
|
|
|
|
|
|
|
(define-button-type 'help-word
|
|
|
|
:supertype 'help-xref
|
|
|
|
'help-function 'dictionary-search
|
|
|
|
'help-echo "mouse-2, RET: describe this word")
|
|
|
|
|
|
|
|
(defun dictionary-display-definition-in-help-buffer (word dictionary definition)
|
|
|
|
"Display DEFINITION, the definition of WORD in DICTIONARY."
|
|
|
|
(let ((help-buffer-under-preparation t))
|
|
|
|
(help-setup-xref (list #'dictionary-search word dictionary)
|
|
|
|
(called-interactively-p 'interactive))
|
|
|
|
(with-help-window (help-buffer)
|
|
|
|
(with-current-buffer (help-buffer)
|
|
|
|
(insert definition)
|
|
|
|
;; Buttonize references to other definitions. These appear as
|
|
|
|
;; words enclosed with curly braces.
|
|
|
|
(goto-char (point-min))
|
|
|
|
(while (re-search-forward (rx "{"
|
|
|
|
(group-n 1 (* (not (any ?}))))
|
|
|
|
"}")
|
|
|
|
nil t)
|
|
|
|
(help-xref-button 1 'help-word
|
|
|
|
(match-string 1)
|
|
|
|
dictionary))))))
|
|
|
|
|
2023-08-12 16:06:10 +02:00
|
|
|
(defvar dictionary-color-support (display-color-p)
|
|
|
|
"Determines if the Emacs has support to display color.")
|
|
|
|
(make-obsolete-variable 'dictionary-color-support 'display-color-p "30.1")
|
|
|
|
|
2020-10-05 06:50:25 +02:00
|
|
|
(provide 'dictionary)
|
|
|
|
;;; dictionary.el ends here
|