├── .github └── workflows │ └── test.yml ├── .gitignore ├── Cask ├── Makefile ├── README.md ├── helm-c-yasnippet.el ├── image └── helm-c-yasnippet.png └── test └── helm-yasnippet-test.el /.github/workflows/test.yml: -------------------------------------------------------------------------------- 1 | name: CI 2 | 3 | on: 4 | pull_request: 5 | push: 6 | paths-ignore: 7 | - '**.md' 8 | 9 | jobs: 10 | build: 11 | runs-on: ubuntu-latest 12 | strategy: 13 | matrix: 14 | emacs_version: 15 | - 28.2 16 | - 29.1 17 | - 'snapshot' 18 | steps: 19 | - uses: actions/checkout@v4 20 | - uses: purcell/setup-emacs@master 21 | with: 22 | version: ${{ matrix.emacs_version }} 23 | - name: Install cask 24 | run: | 25 | git clone https://github.com/cask/cask ~/.cask 26 | echo "${HOME}/.cask/bin" >> $GITHUB_PATH 27 | - name: Run tests 28 | run: make test 29 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.elc 2 | /.cask/ 3 | *~ 4 | -------------------------------------------------------------------------------- /Cask: -------------------------------------------------------------------------------- 1 | (source gnu) 2 | (source melpa) 3 | 4 | (package-file "helm-c-yasnippet.el") 5 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | .PHONY : test clean 2 | 3 | EMACS ?= emacs 4 | CASK ?= cask 5 | 6 | LOADPATH = -L . 7 | 8 | ELPA_DIR = $(shell EMACS=$(EMACS) $(CASK) package-directory) 9 | 10 | test: elpa 11 | $(CASK) exec $(EMACS) -Q -batch $(LOADPATH) \ 12 | -l test/helm-yasnippet-test.el \ 13 | -f ert-run-tests-batch-and-exit 14 | 15 | elpa: $(ELPA_DIR) 16 | $(ELPA_DIR): Cask 17 | $(CASK) install 18 | touch $@ 19 | 20 | clean: 21 | -rm -f *.elc 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # helm-c-yasnippet [![melpa badge][melpa-badge]][melpa-link] [![melpa stable badge][melpa-stable-badge]][melpa-stable-link] [![Github Actions Status][github-actions-badge]][github-actions-link] 2 | 3 | helm source for yasnippet.el 4 | 5 | ## Screenshot 6 | 7 | ![helm-c-yasnippet](image/helm-c-yasnippet.png) 8 | 9 | 10 | ## Installation 11 | 12 | `helm-c-yasnippet` is available on [MELPA][melpa-link] and [MELPA-STABLE][melpa-stable-link]. 13 | 14 | You can install `helm-c-yasnippet` with the following command. 15 | 16 | M-x package-install [RET] helm-c-yasnippet [RET] 17 | 18 | 19 | ## Sample Configuration 20 | 21 | ```lisp 22 | (require 'yasnippet) 23 | (require 'helm-c-yasnippet) 24 | (setq helm-yas-space-match-any-greedy t) 25 | (global-set-key (kbd "C-c y") 'helm-yas-complete) 26 | (yas-global-mode 1) 27 | (yas-load-directory "//snippets/") 28 | ``` 29 | 30 | [melpa-link]: https://melpa.org/#/helm-c-yasnippet 31 | [melpa-stable-link]: https://stable.melpa.org/#/helm-c-yasnippet 32 | [melpa-badge]: https://melpa.org/packages/helm-c-yasnippet-badge.svg 33 | [melpa-stable-badge]: https://stable.melpa.org/packages/helm-c-yasnippet-badge.svg 34 | [github-actions-link]: https://github.com/emacs-jp/helm-c-yasnippet/actions 35 | [github-actions-badge]: https://github.com/emacs-jp/helm-c-yasnippet/workflows/CI/badge.svg 36 | -------------------------------------------------------------------------------- /helm-c-yasnippet.el: -------------------------------------------------------------------------------- 1 | ;;; helm-c-yasnippet.el --- helm source for yasnippet.el -*- lexical-binding: t -*- 2 | 3 | ;; Copyright (C) 2008, 2009, 2010, 2011 Kenji.I (Kenji Imakado) 4 | ;; Copyright (C) 2012,2013 Yuhei Maeda 5 | ;; Copyright (C) 2014 Yuhei Maeda , Yasuyuki Oka 6 | 7 | ;; Author: Kenji.I (Kenji Imakado) 8 | ;; Version: 0.6.7 9 | ;; Package-Requires: ((emacs "25.1") (helm "1.7.7") (yasnippet "0.8.0")) 10 | ;; Keywords: convenience, emulation 11 | 12 | ;; This file is free software; you can redistribute it and/or modify 13 | ;; it under the terms of the GNU General Public License as published by 14 | ;; the Free Software Foundation; either version 2, or (at your option) 15 | ;; any later version. 16 | 17 | ;; This file is distributed in the hope that it will be useful, 18 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of 19 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20 | ;; GNU General Public License for more details. 21 | 22 | ;; You should have received a copy of the GNU General Public License 23 | ;; along with GNU Emacs; see the file COPYING. If not, write to the 24 | ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 25 | ;; Boston, MA 02110-1301, USA. 26 | 27 | ;;; Commentary: 28 | 29 | ;; Actions: Insert snippet, Open snippet file, Open snippet file other window 30 | ;; C-z: execute-persistent-action 31 | 32 | ;;; Changelog: 33 | ;; 2012/08/11 Port to helm 34 | ;; Fixed bug on yasnippet 0.7.0 35 | ;; 2012/08/23 Support yasnippet 0.8.0 36 | ;; 37 | 38 | ;;; Commands: 39 | ;; 40 | ;; Below are complete command list: 41 | ;; 42 | ;; `helm-yas-complete' 43 | ;; List of yasnippet snippets using `helm' interface. 44 | ;; `helm-yas-create-snippet-on-region' 45 | ;; Create a snippet from region. 46 | ;; 47 | ;;; Customizable Options: 48 | ;; 49 | ;; Below are customizable option list: 50 | ;; 51 | ;; `helm-yas-not-display-dups' 52 | ;; if non-nil not display duplicate snippet otherwise display all snippet 53 | ;; default = t 54 | ;; `helm-yas-display-msg-after-complete' 55 | ;; if non-nil display snippet key message in minibuffer after Complete 56 | ;; default = t 57 | ;; `helm-yas-space-match-any-greedy' 58 | ;; if non-nil helm pattern space match anyword greedy. 59 | ;; default = nil 60 | ;; `helm-yas-display-key-on-candidate' 61 | ;; if non-nil helm display candidate(snippet name) include key 62 | ;; default = nil 63 | 64 | ;; here's my yasnippet's configuration 65 | ;; (require 'yasnippet) 66 | ;; (require 'helm-c-yasnippet) 67 | ;; (setq helm-yas-space-match-any-greedy t) ;[default: nil] 68 | ;; (global-set-key (kbd "C-c y") 'helm-yas-complete) 69 | ;; (yas-global-mode 1) 70 | ;; (yas-load-directory "//snippets/") 71 | 72 | ;;; Code: 73 | (require 'cl-lib) 74 | (require 'helm) 75 | (require 'helm-files) 76 | (require 'yasnippet) 77 | 78 | (defgroup helm-yasnippet nil 79 | "helm config yasnippet" 80 | :group 'helm) 81 | 82 | (defcustom helm-yas-not-display-dups t 83 | "if non-nil not display duplicate snippet otherwise display all snippet" 84 | :type 'boolean 85 | :group 'helm-yasnippet) 86 | 87 | (defcustom helm-yas-display-msg-after-complete t 88 | "if non-nil display snippet key message in minibuffer after Complete" 89 | :type 'boolean 90 | :group 'helm-yasnippet) 91 | 92 | (defcustom helm-yas-space-match-any-greedy nil 93 | "if non-nil helm pattern space match anyword greedy. 94 | pattern regexp: \"if else\" replace to \"if.*else\" 95 | match \"if (...) { ... } else { ... }\" and \"if, elsif, else ...\" 96 | quite convenience 97 | Default: nil" 98 | :type 'boolean 99 | :group 'helm-yasnippet) 100 | 101 | (defcustom helm-yas-display-key-on-candidate nil 102 | "if non-nil helm display candidate(snippet name) include key 103 | ex. [for] for (...) { ... } 104 | otherwise display just name 105 | ex. for (...) { ... }" 106 | :type 'boolean 107 | :group 'helm-yasnippet) 108 | 109 | (defcustom helm-yas-create-new-snippet-insert-function 110 | 'helm-yas-create-new-snippet-insert 111 | "Function to be called when create new insert file." 112 | :type 'function 113 | :group 'helm-yasnippet) 114 | 115 | (defface helm-yas-key '((t (:foreground "orange" :underline t))) 116 | "Face used in helm-yas-complete to show key triggers." 117 | :group 'helm-yasnippet) 118 | 119 | (defvar helm-yas-cur-snippets-alist nil) 120 | 121 | (defun helm-yas-create-new-snippet-insert (selected-text snippet-file) 122 | "Insert SELECTED-TEXT into SNIPPET-FILE." 123 | (let* ((name (file-name-sans-extension 124 | (file-name-nondirectory 125 | (directory-file-name snippet-file)))) 126 | (string-format "# -*- mode: snippet -*-\n#name : %s\n#key : %s\n#contributor : %s\n# --\n")) 127 | (insert (format string-format name name user-full-name) selected-text))) 128 | 129 | (defun helm-yas-create-new-snippet-file (selected-text snippet-file) 130 | "Create snippet file with inserted SELECTED-TEXT into SNIPPET-FILE." 131 | (with-current-buffer (find-file snippet-file) 132 | (snippet-mode) 133 | (funcall helm-yas-create-new-snippet-insert-function selected-text snippet-file))) 134 | 135 | (defun helm-yas-create-new-snippet (selected-text &optional snippet-file) 136 | "Create snippet from SELECTED-TEXT into SNIPPET-FILE. 137 | If SNIPPET-FILE is nil, asks file name. 138 | If SNIPPET-FILE does not contain directory, it is placed in default snippet directory." 139 | (let* ((major-mode-dir (symbol-name major-mode)) 140 | (yas-dir (file-name-as-directory (expand-file-name (or (car-safe yas-snippet-dirs) yas-snippet-dirs)))) 141 | (snippet-dir 142 | (or (helm-yas-find-recursively major-mode-dir yas-dir 'dir) 143 | (let ((target-dir (file-name-as-directory (concat yas-dir major-mode-dir)))) 144 | (if (yes-or-no-p (format "%s doesn't exist. Would you like to create this directory?" target-dir)) 145 | (progn 146 | (make-directory target-dir) 147 | target-dir) 148 | (deactivate-mark) 149 | (error "Snippet creation failed")))))) 150 | (setq snippet-file 151 | (helm-aif snippet-file 152 | (expand-file-name snippet-file snippet-dir) 153 | (read-file-name "create snippet : " snippet-dir snippet-dir))) 154 | (when (file-exists-p snippet-file) 155 | (error "can't create file [%s] already exists" (file-name-nondirectory snippet-file))) 156 | (helm-yas-create-new-snippet-file selected-text snippet-file))) 157 | 158 | (defun helm-yas-find-recursively (name &optional directory predicate) 159 | (let* ((directory (or directory default-directory)) 160 | (predfunc (cl-case predicate 161 | (dir 'file-directory-p) 162 | (file 'file-regular-p) 163 | (otherwise 'identity))) 164 | (files (cl-remove-if (lambda (s) (string-match "^\\." (file-name-nondirectory s))) (directory-files directory t))) 165 | (found nil) 166 | (result nil)) 167 | (cl-loop for file in files 168 | unless found 169 | do (if (and (funcall predfunc file) 170 | (string= name (file-name-nondirectory file))) 171 | (progn (setq found t) 172 | (cl-return (file-name-as-directory file))) 173 | (when (file-directory-p file) 174 | (setq result (helm-yas-find-recursively name file predicate)))) 175 | finally (cl-return result)))) 176 | 177 | 178 | (defun helm-yas-build-cur-snippets-alist (&optional table) 179 | (let ((yas-choose-keys-first nil) 180 | (yas-choose-tables-first nil) 181 | (yas-buffer-local-condition 'always)) 182 | (let* ((result-alist '((candidates) (transformed) (template-key-alist) 183 | (template-file-alist) (template-expand-env-alist))) 184 | (cur-tables 185 | (if table 186 | (list table) 187 | (yas--get-snippet-tables))) 188 | (hash-value-alist nil)) 189 | (let ((hashes (cl-loop for table in cur-tables 190 | collect (yas--table-hash table)))) 191 | (cl-loop for hash in hashes 192 | do (maphash (lambda (k v) 193 | (let (a) 194 | (maphash (lambda (_n te) 195 | (setq a (append (list (cons k te)) a))) 196 | v) 197 | (setq hash-value-alist (append a hash-value-alist)))) 198 | hash)) 199 | (cl-loop with transformed 200 | with templates 201 | with template-key-alist 202 | with template-file-alist 203 | with template-expand-env-alist 204 | for lst in hash-value-alist 205 | for key = (car lst) 206 | for template-struct = (cdr lst) 207 | for name = (yas--template-name template-struct) ;`yas--template-name' 208 | for template = (yas--template-content template-struct) ;`yas--template-content' 209 | for file = (yas--template-load-file template-struct) ;`yas--template-content' 210 | for condition = (yas--template-condition template-struct) 211 | for expand-env = (yas--template-expand-env template-struct) 212 | when (or (not condition) (ignore-errors (eval condition))) 213 | do (progn (push template templates) 214 | (push `(,name . ,template) transformed) 215 | (push `(,template . ,key) template-key-alist) 216 | (push `(,template . ,file) template-file-alist) 217 | (push `(,template . ,expand-env) template-expand-env-alist) 218 | ) 219 | finally (progn (push `(candidates . ,templates) result-alist) 220 | (push `(transformed . ,transformed) result-alist) 221 | (push `(template-file-alist . ,template-file-alist) result-alist) 222 | (push `(template-key-alist . ,template-key-alist) result-alist) 223 | (push `(template-expand-env-alist . ,template-expand-env-alist) result-alist) 224 | )) 225 | result-alist) 226 | ))) 227 | 228 | (defun helm-yas-get-cmp-context () 229 | "Return list (initial-input point-start point-end) 230 | like `yas--current-key'" 231 | (let ((start (point)) 232 | (end (point)) 233 | (syntax "w_")) 234 | (condition-case nil 235 | (save-excursion 236 | (when mark-active 237 | (error "")) 238 | (skip-syntax-backward syntax) 239 | (setq start (point)) 240 | (cl-values (buffer-substring-no-properties start end) start end)) 241 | (error (cl-values "" (point) (point)))))) 242 | 243 | (defun helm-yas-get-key-by-template (template alist) ;str template 244 | "Return key" 245 | (assoc-default template (assoc-default 'template-key-alist alist))) 246 | 247 | (defun helm-yas-get-candidates (alist) 248 | "Return list of template" 249 | (assoc-default 'candidates alist 'eq)) 250 | 251 | (defun helm-yas-get-transformed-list (alist initial-input) 252 | "Return list of dotlist, (DISPLAY . REAL) DISPLAY is name of snippet, REAL is template of snippet" 253 | (let ((transformed-list (assoc-default 'transformed alist 'eq))) 254 | (cond 255 | ;; display key on candidate ex: [for] for (...) { ... } 256 | (helm-yas-display-key-on-candidate 257 | (setq transformed-list (cl-remove-if-not (lambda (lst) 258 | (string-match (concat "^" (regexp-quote initial-input)) (car lst))) 259 | transformed-list)) 260 | (setq transformed-list (cl-loop for dotlst in transformed-list 261 | for name = (car dotlst) 262 | for template = (cdr dotlst) 263 | for key = (helm-yas-get-key-by-template template alist) 264 | for key-str = (cond ((stringp key) key) 265 | ((vectorp key) (key-description key)) 266 | (t (format "%s" key))) 267 | for name-inc-key = (concat "[" (propertize key-str 'face 'helm-yas-key) "] " name) 268 | collect `(,name-inc-key . ,template)))) 269 | 270 | ;; default ex: for (...) { ... } 271 | (t 272 | (setq transformed-list (cl-remove-if-not (lambda (lst) 273 | (string-match (concat "^" (regexp-quote initial-input)) (car lst))) 274 | transformed-list)))) 275 | (when helm-yas-not-display-dups 276 | (setq transformed-list (delete-dups transformed-list))) 277 | ;; sort 278 | (setq transformed-list (cl-sort transformed-list 'string< :key 'car)) 279 | transformed-list)) 280 | 281 | (defun helm-yas-find-file-snippet-by-template (template &optional other-window) 282 | (let* ((path (helm-yas-get-path-by-template template)) 283 | ;; (let* ((path (assoc-default template (assoc-default 'template-file-alist helm-yas-cur-snippets-alist))) 284 | (ff-func (if other-window 'find-file-other-window 'find-file))) 285 | (if path 286 | (funcall ff-func path) 287 | (message "not found snippet file")))) 288 | 289 | (defun helm-yas-get-path-by-template (template) 290 | (assoc-default template (assoc-default 'template-file-alist helm-yas-cur-snippets-alist))) 291 | 292 | (defun helm-yas-get-expand-env-by-template (template) 293 | (assoc-default template (assoc-default 'template-expand-env-alist helm-yas-cur-snippets-alist))) 294 | 295 | (defun helm-yas-match (candidate) 296 | "if customize variable `helm-yas-space-match-any-greedy' is non-nil 297 | space match anyword greedy" 298 | (cond 299 | (helm-yas-space-match-any-greedy 300 | (let ((re (replace-regexp-in-string "[ \t]+" ".*" helm-pattern))) 301 | (string-match re candidate))) 302 | (t 303 | (string-match helm-pattern candidate)))) 304 | 305 | (defvar helm-yas-initial-input "") 306 | (defvar helm-yas-point-start nil) 307 | (defvar helm-yas-point-end nil) 308 | (defvar helm-yas-selected-text "" "region text if mark-active otherwise \"\"") 309 | (defvar helm-source-yasnippet 310 | `((name . "Yasnippet") 311 | (init . (lambda () 312 | (setq helm-yas-selected-text (if mark-active (buffer-substring-no-properties (region-beginning) (region-end)) "")) 313 | (cl-multiple-value-setq 314 | (helm-yas-initial-input helm-yas-point-start helm-yas-point-end) (helm-yas-get-cmp-context)) ;return values(str point point) 315 | (setq helm-yas-cur-snippets-alist (helm-yas-build-cur-snippets-alist)))) 316 | (candidates . (helm-yas-get-candidates helm-yas-cur-snippets-alist)) 317 | (candidate-transformer . (lambda (candidates) 318 | (helm-yas-get-transformed-list helm-yas-cur-snippets-alist helm-yas-initial-input))) 319 | (action . (("Insert snippet" . (lambda (template) 320 | (yas-expand-snippet template helm-yas-point-start helm-yas-point-end 321 | (helm-yas-get-expand-env-by-template template)) 322 | (when helm-yas-display-msg-after-complete 323 | (message "this snippet is bound to [ %s ]" 324 | (helm-yas-get-key-by-template template helm-yas-cur-snippets-alist))))) 325 | ("Open snippet file" . (lambda (template) 326 | (helm-yas-find-file-snippet-by-template template))) 327 | ("Open snippet file other window" . (lambda (template) 328 | (helm-yas-find-file-snippet-by-template template t))) 329 | ("Create new snippet on region" . (lambda (template) 330 | (helm-yas-create-new-snippet helm-yas-selected-text))) 331 | ("Reload All Snippts" . (lambda (template) 332 | (yas-reload-all) 333 | (message "Reload All Snippts done"))) 334 | ("Rename snippet file" . (lambda (template) 335 | (let* ((path (or (helm-yas-get-path-by-template template) "")) 336 | (dir (file-name-directory path)) 337 | (filename (file-name-nondirectory path)) 338 | (rename-to (read-string (concat "rename [" filename "] to: ")))) 339 | (rename-file path (concat dir rename-to)) 340 | (yas-reload-all)))) 341 | ("Delete snippet file" . (lambda (template) 342 | (let ((path (or (helm-yas-get-path-by-template template) ""))) 343 | (when (y-or-n-p "really delete?") 344 | (delete-file path) 345 | (yas-reload-all))))))) 346 | (persistent-action . (lambda (template) 347 | (helm-yas-find-file-snippet-by-template template))) 348 | (match . (helm-yas-match)))) 349 | 350 | 351 | ;;; visit template 352 | (defun helm-yas-all-templates () 353 | (let ((tables (yas--get-snippet-tables))) 354 | (cl-loop for table in tables 355 | append (yas--table-templates table)))) 356 | 357 | (defun helm-yas-snippet-files-candidates () 358 | "called in `helm-source-yasnippet-snippet-files' candidates" 359 | (let ((yas-choose-keys-first nil) 360 | (yas-choose-tables-first nil) 361 | (yas-buffer-local-condition 'always)) 362 | (with-current-buffer helm-current-buffer 363 | (cl-mapcar 'yas--template-load-file 364 | (mapcar 'cdr 365 | (helm-yas-all-templates)))))) 366 | 367 | (defun helm-yas--visit-files-transformer (candidate) 368 | (file-name-nondirectory candidate)) 369 | 370 | ;; (helm 'helm-source-yasnippet-snippet-files) 371 | (defvar helm-source-yasnippet-snippet-files 372 | (helm-build-sync-source "yasnippet snippet files" 373 | :candidates #'helm-yas-snippet-files-candidates 374 | :real-to-display #'helm-yas--visit-files-transformer 375 | :action (helm-actions-from-type-file))) 376 | 377 | 378 | ;;; Commands 379 | 380 | ;;;###autoload 381 | (defun helm-yas-complete () 382 | "List of yasnippet snippets using `helm' interface." 383 | (interactive) 384 | (helm 'helm-source-yasnippet)) 385 | 386 | ;;;###autoload 387 | (defun helm-yas-visit-snippet-file () 388 | "List of yasnippet snippet files" 389 | (interactive) 390 | (helm 'helm-source-yasnippet-snippet-files)) 391 | 392 | ;;;###autoload 393 | (defun helm-yas-create-snippet-on-region (&optional start end file-name) 394 | "Create a snippet from region." 395 | (interactive "r") 396 | (let ((str (buffer-substring-no-properties start end))) 397 | (helm-yas-create-new-snippet str file-name))) 398 | ;; (helm-yas-create-snippet-on-region (region-beginning) (region-end) "aaaa") 399 | 400 | 401 | (define-obsolete-variable-alias 'helm-c-yas-not-display-dups 'helm-yas-not-display-dups "0.6.4") 402 | (define-obsolete-variable-alias 'helm-c-yas-display-msg-after-complete 'helm-yas-display-msg-after-complete "0.6.4") 403 | (define-obsolete-variable-alias 'helm-c-yas-space-match-any-greedy 'helm-yas-space-match-any-greedy "0.6.4") 404 | (define-obsolete-variable-alias 'helm-c-yas-display-key-on-candidate 'helm-yas-display-key-on-candidate "0.6.4") 405 | (define-obsolete-variable-alias 'helm-c-yas-cur-snippets-alist 'helm-yas-cur-snippets-alist "0.6.4") 406 | (define-obsolete-variable-alias 'helm-c-yas-initial-input 'helm-yas-initial-input "0.6.4") 407 | (define-obsolete-variable-alias 'helm-c-yas-point-start 'helm-yas-point-start "0.6.4") 408 | (define-obsolete-variable-alias 'helm-c-yas-point-end 'helm-yas-point-end "0.6.4") 409 | (define-obsolete-variable-alias 'helm-c-yas-selected-text 'helm-yas-selected-text "0.6.4") 410 | (define-obsolete-variable-alias 'helm-c-source-yasnippet 'helm-source-yasnippet "0.6.4") 411 | (define-obsolete-variable-alias 'helm-c-source-yasnippet-snippet-files 'helm-source-yasnippet-snippet-files "0.6.4") 412 | 413 | (define-obsolete-function-alias 'helm-c-yas-create-new-snippet 'helm-yas-create-new-snippet "0.6.4") 414 | (define-obsolete-function-alias 'helm-c-yas-find-recursively 'helm-yas-find-recursively "0.6.4") 415 | (define-obsolete-function-alias 'helm-c-yas-build-cur-snippets-alist 'helm-yas-build-cur-snippets-alist "0.6.4") 416 | (define-obsolete-function-alias 'helm-c-yas-get-cmp-context 'helm-yas-get-cmp-context "0.6.4") 417 | (define-obsolete-function-alias 'helm-c-yas-get-key-by-template 'helm-yas-get-key-by-template "0.6.4") 418 | (define-obsolete-function-alias 'helm-c-yas-get-candidates 'helm-yas-get-candidates "0.6.4") 419 | (define-obsolete-function-alias 'helm-c-yas-get-transformed-list 'helm-yas-get-transformed-list "0.6.4") 420 | (define-obsolete-function-alias 'helm-c-yas-find-file-snippet-by-template 'helm-yas-find-file-snippet-by-template "0.6.4") 421 | (define-obsolete-function-alias 'helm-c-yas-get-path-by-template 'helm-yas-get-path-by-template "0.6.4") 422 | (define-obsolete-function-alias 'helm-c-yas-match 'helm-yas-match "0.6.4") 423 | (define-obsolete-function-alias 'helm-c-yas-all-templates 'helm-yas-all-templates "0.6.4") 424 | (define-obsolete-function-alias 'helm-c-yas-snippet-files-candidates 'helm-yas-snippet-files-candidates "0.6.4") 425 | (define-obsolete-function-alias 'helm-c-yas-complete 'helm-yas-complete "0.6.4") 426 | (define-obsolete-function-alias 'helm-c-yas-visit-snippet-file 'helm-yas-visit-snippet-file "0.6.4") 427 | (define-obsolete-function-alias 'helm-c-yas-create-snippet-on-region 'helm-yas-create-snippet-on-region "0.6.4") 428 | 429 | (provide 'helm-c-yasnippet) 430 | ;;; helm-c-yasnippet.el ends here 431 | -------------------------------------------------------------------------------- /image/helm-c-yasnippet.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emacs-jp/helm-c-yasnippet/c5880e740da101fde7a995e94a7b16c330e57583/image/helm-c-yasnippet.png -------------------------------------------------------------------------------- /test/helm-yasnippet-test.el: -------------------------------------------------------------------------------- 1 | ;;; helm-yasnippet-test.el --- test commands of helm-yasnippet -*- lexical-binding: t -*- 2 | 3 | ;; Copyright (C) 2023 by Shohei YOSHIDA 4 | 5 | ;; Author: Shohei YOSHIDA 6 | 7 | ;; This program is free software; you can redistribute it and/or modify 8 | ;; it under the terms of the GNU General Public License as published by 9 | ;; the Free Software Foundation, either version 3 of the License, or 10 | ;; (at your option) any later version. 11 | 12 | ;; This program is distributed in the hope that it will be useful, 13 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | ;; GNU General Public License for more details. 16 | 17 | ;; You should have received a copy of the GNU General Public License 18 | ;; along with this program. If not, see . 19 | 20 | ;;; Commentary: 21 | 22 | ;;; Code: 23 | 24 | (require 'ert) 25 | (require 'helm-c-yasnippet) 26 | (require 'cl-lib) 27 | 28 | (ert-deftest regression-issue-28 () 29 | "Find major-mode directory with string not regexp. 30 | Detail: https://github.com/emacs-jp/helm-c-yasnippet/pull/28" 31 | (let ((tmpdir (concat temporary-file-directory "helm-yasnippet/"))) 32 | (delete-directory tmpdir t) 33 | (cl-loop for dir in '("sh-mode" "fish-mode") 34 | do 35 | (make-directory (concat tmpdir dir) t)) 36 | (let ((dir (helm-yas-find-recursively "sh-mode" tmpdir 'dir))) 37 | (should (string= dir (concat tmpdir "sh-mode/")))) 38 | (delete-directory tmpdir t))) 39 | 40 | ;;; helm-yasnippet-test.el ends here 41 | --------------------------------------------------------------------------------