ishideo
10/16/2017 - 5:45 AM

get-num-dash.el

;; -*- 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))))))))