-
Notifications
You must be signed in to change notification settings - Fork 9
Make the suggestions in the failure buffer interactive #29
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -340,7 +340,7 @@ Using `lexic-current-dictionary-list' and `lexic-dictionary-path'." | |
| (defun lexic-return-from-lexic () | ||
| "Bury lexic buffer and restore the previous window configuration." | ||
| (interactive) | ||
| (kill-process (get-process lexic-process-name)) | ||
| (ignore-errors (kill-process (get-process lexic-process-name))) | ||
| (if (window-configuration-p lexic-previous-window-conf) | ||
| (progn | ||
| (set-window-configuration lexic-previous-window-conf) | ||
|
|
@@ -652,7 +652,7 @@ Returns a list of plists with keys :word, :dict, and :info." | |
| "When lexic failed to match the word, format the suggestions in RESULTS." | ||
| (let (suggestions last-match) | ||
| (while (setq last-match | ||
| (string-match "^[0-9]+)\\(.*\\)-->\\([A-Za-z]+\\)" | ||
| (string-match "^[0-9]+)\\(.*\\)-->\\(.*\\)" | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This makes sure to include the whole suggestion, so that it can be searched.
|
||
| results | ||
| (when last-match (1+ last-match)))) | ||
| (let ((dict (match-string 1 results)) | ||
|
|
@@ -662,21 +662,33 @@ Returns a list of plists with keys :word, :dict, and :info." | |
| (list (append (cadr (assoc dict suggestions)) (list word)))) | ||
| (setq suggestions (append suggestions `((,dict . ((,word))))))))) | ||
| (concat | ||
| "\u200B" | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. a hack(?) to make sure that the point does not get before the first heading (which makes outline navigation not work) |
||
| (propertize | ||
| (replace-regexp-in-string | ||
| "items" "entries" | ||
| (substring results 0 (string-match "\n" results))) | ||
| 'face 'warning) | ||
| "\n" | ||
| (mapconcat (lambda (dict-suggestions) | ||
| (format "\u200B\u200B%s\n\u200B\u200B\u200B%s" | ||
| (format "%s\n%s" | ||
| (propertize (or | ||
| (lexic-dictionary-spec (car dict-suggestions) :short) | ||
| (car dict-suggestions)) | ||
| 'face 'outline-3) | ||
| (propertize | ||
| (mapconcat #'identity (cadr dict-suggestions) "\n\u200B\u200B\u200B") | ||
| 'face 'font-lock-keyword-face))) | ||
| (mapconcat (lambda (entry) | ||
| (propertize | ||
| (format "\u200B\u200B%s" entry) | ||
| ;; (mapconcat #'identity (cadr dict-suggestions) "\n\u200B\u200B\u200B") | ||
| 'face 'font-lock-keyword-face | ||
| 'keymap (let ((map (make-sparse-keymap))) | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The main part - propertizing the entry with keymap. |
||
| (define-key map (kbd "<RET>") | ||
| (lambda () | ||
| (interactive) | ||
| (lexic-search entry nil (list (car dict-suggestions)) t) | ||
| (setq lexic-current-dictionary-list t))) | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. A hack(?) to reset the lexic-current-dictionary-list. Without this, lexic remembers the particular dictionary until called with prefix argument. |
||
| map))) | ||
| (cadr dict-suggestions) | ||
| "\n"))) | ||
| (sort suggestions | ||
| (lambda (a b) | ||
| (< (or (lexic-dictionary-spec (car a) :priority) 1) | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
unrelated fix of small annoyance - sometimes pressing 'q' did not bury the buffer, because killing the already dead buffer caused an error