Skip to content

Instantly share code, notes, and snippets.

@ishideo
Created October 16, 2017 05:45
Show Gist options
  • Save ishideo/4cd8466f9639870b5431d62066aaab1d to your computer and use it in GitHub Desktop.
Save ishideo/4cd8466f9639870b5431d62066aaab1d to your computer and use it in GitHub Desktop.
;; -*- coding: utf-8; lexical-binding: t -*-
;; get-num-dash.el abc.txt xyz
(load-file (expand-file-name "~/.emacs.d/elpa/s-xxxxxxxxx.xxxx/s.el"))
(load-file (expand-file-name "~/.emacs.d/elpa/dash-xxxxxxxxx.xxxx/dash.el"))
(load-file (expand-file-name "~/.emacs.d/elpa/dash-functional-xxxxxxxx.xxxx/dash-functional.el"))
(load-file (expand-file-name "~/.emacs.d/elpa/f-xxxxxxxxx.xxxx/f.el"))
(load-file (expand-file-name "~/.emacs.d/elpa/ht-xxxxxxxxx.xxxx/ht.el"))
(require 'cl-extra)
(defun get-num (file words)
(with-temp-buffer
(insert-file-contents-literally file)
(goto-char (point-min))
(unless
(cl-some #'null
(mapcar #'(lambda (x)
(search-forward x nil t))
words))
(end-of-line)
(thing-at-point 'filename))))
(let ((file (car argv))
(words (cdr argv)))
(princ (concat (get-num file words) "\n")))
(print (-flatten '((1 (2 3) (((4 (5))))))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment