Skip to content

Instantly share code, notes, and snippets.

@ishideo
Created October 16, 2017 05:42
Show Gist options
  • Save ishideo/36c1df23a70d927b61b617b8980f29c9 to your computer and use it in GitHub Desktop.
Save ishideo/36c1df23a70d927b61b617b8980f29c9 to your computer and use it in GitHub Desktop.
;; -*- coding: utf-8; lexical-binding: t -*-
;; get-num.el abc.txt xyz
(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")))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment