1 ;;; consel.el --- Elisp completion at point -*- lexical-binding: t -*-
3 ;; Copyright (C) 2015 Free Software Foundation, Inc.
5 ;; Author: Oleh Krehel <ohwoeowho@gmail.com>
7 ;; This file is part of GNU Emacs.
9 ;; This file is free software; you can redistribute it and/or modify
10 ;; it under the terms of the GNU General Public License as published by
11 ;; the Free Software Foundation; either version 3, or (at your option)
14 ;; This program is distributed in the hope that it will be useful,
15 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
16 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 ;; GNU General Public License for more details.
19 ;; For a full copy of the GNU General Public License
20 ;; see <http://www.gnu.org/licenses/>.
24 ;; Just call `counsel' to start completing the `obarray'.
25 ;; The initial (optional) input is thing-at-point.
32 "Elisp completion at point."
35 (lambda (str) (all-completions str obarray))))
38 "Clojure completion at point."
44 (cider-sync-request:complete str ":same")))))
47 "Find file in the current Git repository."
49 (let* ((default-directory (locate-dominating-file
50 default-directory ".git"))
52 (shell-command-to-string
53 "git ls-files --full-name --")
56 (file (ivy-read "Find file: " cands)))
60 (defun counsel--generic (completion-fn)
61 "Complete thing at point with COMPLETION-FN."
62 (let* ((bnd (bounds-of-thing-at-point 'symbol))
64 (buffer-substring-no-properties
67 (candidates (funcall completion-fn str))
69 (res (ivy-read (format "pattern (%s): " str)
73 (delete-region (car bnd) (cdr bnd)))
78 ;;; counsel.el ends here