[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master d8abbc6 2/2: Merge commit 'af746cad0e9c5d010ea530381111372
From: |
Oleh Krehel |
Subject: |
[elpa] master d8abbc6 2/2: Merge commit 'af746cad0e9c5d010ea530381111372f7daae55b' from swiper |
Date: |
Sun, 9 Apr 2017 05:15:32 -0400 (EDT) |
branch: master
commit d8abbc630d63d3e21677d8cbdbcb1fb5ba78c700
Merge: e1351c8 af746ca
Author: Oleh Krehel <address@hidden>
Commit: Oleh Krehel <address@hidden>
Merge commit 'af746cad0e9c5d010ea530381111372f7daae55b' from swiper
---
packages/ivy/Makefile | 2 +-
packages/ivy/counsel.el | 6 ---
packages/ivy/doc/Changelog.org | 3 +-
packages/ivy/ivy-overlay.el | 114 +++++++++++++++++++++++++++++++++++++++++
4 files changed, 117 insertions(+), 8 deletions(-)
diff --git a/packages/ivy/Makefile b/packages/ivy/Makefile
index 01e7dd0..902ce8a 100644
--- a/packages/ivy/Makefile
+++ b/packages/ivy/Makefile
@@ -9,7 +9,7 @@ test:
$(emacs) -batch $(LOAD) -l ivy-test.el -f ert-run-tests-batch-and-exit
compile:
- $(emacs) -batch --eval "(progn (add-to-list 'load-path
default-directory) (mapc #'byte-compile-file '(\"ivy.el\" \"swiper.el\"
\"counsel.el\")))"
+ $(emacs) -batch --eval "(progn (add-to-list 'load-path
default-directory) (mapc #'byte-compile-file '(\"ivy.el\" \"swiper.el\"
\"counsel.el\" \"colir.el\")))"
plain:
$(emacs) --version
diff --git a/packages/ivy/counsel.el b/packages/ivy/counsel.el
index f47ad2f..4f5b392 100644
--- a/packages/ivy/counsel.el
+++ b/packages/ivy/counsel.el
@@ -1480,12 +1480,6 @@ When INITIAL-INPUT is non-nil, use it in the minibuffer
during completion."
(format "http://debbugs.gnu.org/cgi/bugreport.cgi?bug=%s"
(substring url 1)))))))
-;;** `counsel-locate'
-(defcustom counsel-locate-options nil
- "Command line options for `locate'."
- :group 'ivy
- :type '(repeat string))
-
;;** `counsel-recentf'
(defvar recentf-list)
(declare-function recentf-mode "recentf")
diff --git a/packages/ivy/doc/Changelog.org b/packages/ivy/doc/Changelog.org
index 0af0db2..7eb046c 100644
--- a/packages/ivy/doc/Changelog.org
+++ b/packages/ivy/doc/Changelog.org
@@ -2114,10 +2114,11 @@ See
[[https://github.com/abo-abo/swiper/issues/714][#714]].
See [[https://github.com/abo-abo/swiper/issues/833][#833]].
-----
*** =ivy--filter=
-Recompute index after filter
:PROPERTIES:
:CUSTOM_ID: 0-9-0-fx-ivy--filter-recompute-index-after-filter
:END:
+Recompute index after filter.
+
See [[https://github.com/abo-abo/swiper/issues/491][#491]].
-----
*** =ivy--flx-sort=
diff --git a/packages/ivy/ivy-overlay.el b/packages/ivy/ivy-overlay.el
new file mode 100644
index 0000000..78344c7
--- /dev/null
+++ b/packages/ivy/ivy-overlay.el
@@ -0,0 +1,114 @@
+;;; ivy-overlay.el --- Overlay display functions for Ivy -*- lexical-binding:
t -*-
+
+;; Copyright (C) 2016-2017 Free Software Foundation, Inc.
+
+;; Author: Oleh Krehel <address@hidden>
+;; Keywords: convenience
+
+;; This program is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; This program is distributed in the hope that it will be useful,
+;; 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
+;; along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+;;; Commentary:
+;;
+;; This package allows to setup Ivy's completion at point to actually
+;; show the candidates and the input at point, instead of in the
+;; minibuffer.
+
+;;; Code:
+(defface ivy-cursor
+ '((t (:background "black"
+ :foreground "white")))
+ "Cursor face for inline completion."
+ :group 'ivy-faces)
+
+(defvar ivy--old-cursor-type t)
+
+(defvar ivy-overlay-at nil
+ "Overlay variable for `ivy-display-function-overlay'.")
+
+(defun ivy-left-pad (str width)
+ "Pad STR from left with WIDTH spaces."
+ (let ((padding (make-string width ?\ )))
+ (mapconcat (lambda (x)
+ (setq x (concat padding x))
+ (if (> (length x) (window-width))
+ (concat
+ (substring x 0 (- (window-width) 4))
+ "...")
+ x))
+ (split-string str "\n")
+ "\n")))
+
+(declare-function company-abort "ext:company")
+
+(defun ivy-overlay-cleanup ()
+ "Clean up after `ivy-display-function-overlay'."
+ (when (overlayp ivy-overlay-at)
+ (delete-overlay ivy-overlay-at)
+ (setq ivy-overlay-at nil))
+ (unless cursor-type
+ (setq cursor-type ivy--old-cursor-type))
+ (when (fboundp 'company-abort)
+ (company-abort)))
+
+(defun ivy-overlay-show-after (str)
+ "Display STR in an overlay at point.
+
+First, fill each line of STR with spaces to the current column.
+Then attach the overlay the character before point."
+ (if ivy-overlay-at
+ (progn
+ (move-overlay ivy-overlay-at (1- (point)) (line-end-position))
+ (overlay-put ivy-overlay-at 'invisible nil))
+ (setq ivy-overlay-at (make-overlay (1- (point)) (line-end-position)))
+ (overlay-put ivy-overlay-at 'priority 9999))
+ (overlay-put ivy-overlay-at 'display str)
+ (overlay-put ivy-overlay-at 'after-string ""))
+
+(declare-function org-current-level "org")
+(defvar org-indent-indentation-per-level)
+
+(defun ivy-display-function-overlay (str)
+ "Called from the minibuffer, display STR in an overlay in Ivy window.
+Hide the minibuffer contents and cursor."
+ (add-face-text-property (minibuffer-prompt-end) (point-max)
+ '(:foreground "white"))
+ (let ((cursor-pos (1+ (- (point) (minibuffer-prompt-end))))
+ (ivy-window (ivy--get-window ivy-last)))
+ (setq cursor-type nil)
+ (with-selected-window ivy-window
+ (when cursor-type
+ (setq ivy--old-cursor-type cursor-type))
+ (setq cursor-type nil)
+ (let ((overlay-str
+ (concat
+ (buffer-substring (max 1 (1- (point))) (point))
+ ivy-text
+ (if (eolp)
+ " "
+ "")
+ (buffer-substring (point) (line-end-position))
+ (ivy-left-pad
+ str
+ (+ (if (eq major-mode 'org-mode)
+ (* org-indent-indentation-per-level (org-current-level))
+ 0)
+ (save-excursion
+ (goto-char ivy-completion-beg)
+ (current-column)))))))
+ (add-face-text-property cursor-pos (1+ cursor-pos)
+ 'ivy-cursor t overlay-str)
+ (ivy-overlay-show-after overlay-str)))))
+
+(provide 'ivy-overlay)
+;;; ivy-overlay.el ends here
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [elpa] master d8abbc6 2/2: Merge commit 'af746cad0e9c5d010ea530381111372f7daae55b' from swiper,
Oleh Krehel <=