Moved my elisp modes to dedicated directory to not mixt with init.el.
authorOleksandr Gavenko <gavenkoa@gmail.com>
Sat, 02 Jan 2021 00:33:04 +0200
changeset 1666 06937ff1ec5f
parent 1665 3685e2321a9b
child 1667 7f70095fbf32
Moved my elisp modes to dedicated directory to not mixt with init.el.
Makefile
ag.el
autobm.el
debian-doc.el
log4-hi-mode.el
maven-central.el
maven.el
my-log-mode.el
mylisp/ag.el
mylisp/autobm.el
mylisp/debian-doc.el
mylisp/log4-hi-mode.el
mylisp/maven-central.el
mylisp/maven.el
mylisp/my-log-mode.el
mylisp/mypasshide.el
mylisp/pypi.el
mylisp/spring-actuator.el
mypasshide.el
pypi.el
spring-actuator.el
upgrade/2.bash
--- a/Makefile	Sat Jan 02 00:27:54 2021 +0200
+++ b/Makefile	Sat Jan 02 00:33:04 2021 +0200
@@ -44,10 +44,10 @@
 # Installation directories and files.
 
 emacsdir := $(HOME)/.emacs.d
-mylispdir := $(emacsdir)/my
+mylispdir := $(emacsdir)/mylisp
 
 # Compatibility version.
-COMPAT_VER := 1
+COMPAT_VER := 2
 COMPAT_FILE := $(emacsdir)/.emacs-ver
 
 ################################################################
@@ -64,7 +64,7 @@
 ################################################################
 # Proj dirs/files.
 
-EL_FILES := $(filter-out %.dev.el,$(wildcard *.el))
+EL_FILES := $(wildcard mylisp/*.el)
 ELC_FILES := $(EL_FILES:.el=.elc)
 
 RST_FILES := $(wildcard *.rst)
@@ -181,7 +181,7 @@
 .PHONY: check-byte-compile
 check-byte-compile:
 	\
-$(EMACS) -f package-initialize --eval '(push "." load-path)'  --batch -f batch-byte-compile $(filter-out init.el,$(EL_FILES)) || :
+$(EMACS) -f package-initialize --eval '(push "mylisp" load-path)'  --batch -f batch-byte-compile $(EL_FILES) || :
 	rm -f $(ELC_FILES)
 
 ################################################################
--- a/ag.el	Sat Jan 02 00:27:54 2021 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,144 +0,0 @@
-;;; ag.el --- Ag frontend
-
-;;; Commentary:
-;;
-
-(defgroup my-ag nil
-  "My own ag search front-end."
-  :prefix "my-ag"
-  :group 'tools
-  :group 'processes)
-
-(defun my-ag-goto ()
-  (interactive)
-  (save-excursion
-    (let ( lineno end )
-      (forward-line 1)
-      (backward-char 1)
-      (setq end (point))
-      (forward-line 0)
-      (if (not (search-forward-regexp "^\\([1-9][0-9]*\\)[:-]" end t))
-          (message "Not at line number...")
-        (setq lineno (string-to-number (match-string 1)))
-        (if (search-backward-regexp "^$" nil t)
-            (forward-char)
-          (goto-char (point-min)))
-        (search-forward-regexp "^.*")
-        (find-file-other-window (match-string 0))
-        (goto-char (point-min))
-        (forward-line (1- lineno))))))
-
-(defun my-ag-kill-process ()
-  (interactive)
-  (let ( (proc (get-buffer-process (current-buffer))) )
-    (if proc
-	(interrupt-process proc)
-      (error "The %s process is not running" (downcase mode-name)))))
-
-(defvar my-ag-mode-map (make-sparse-keymap))
-
-(define-key my-ag-mode-map (kbd "RET") 'my-ag-goto)
-(define-key my-ag-mode-map (kbd "C-c C-k") 'my-ag-kill-process)
-
-(defface my-ag/lineno-face
-  '((t :inherit warning))
-  "Face for line number."
-  :group 'my-ag)
-(defface my-ag/path-face
-  '((t :inherit success))
-  "Face for line number."
-  :group 'my-ag)
-
-(defvar my-ag/keywords
-  '(("^[1-9][0-9]\\{0,5\\}[-:]" . (0 'my-ag/lineno-face))
-    ("^[^:]\\{6\\}.*" . (0 'my-ag/path-face))))
-
-(define-derived-mode my-ag-mode fundamental-mode "Ag"
-  "Major mode for Ag parsing."
-  (setq font-lock-defaults '(my-ag/keywords t nil nil)) ;  (font-lock-multiline . t)
-  (use-local-map my-ag-mode-map))
-
-(defvar my-ag/buffer-name "*ag*")
-(defvar my-ag/buffer nil)
-
-(defun my-ag/filter (proc str)
-  (when (buffer-live-p (process-buffer proc))
-    (with-current-buffer (process-buffer proc)
-      (save-excursion
-        (goto-char (process-mark proc))
-        (insert str)
-        (set-marker (process-mark proc) (point)))
-      )))
-
-(defvar my-ag/regex-history nil)
-
-(defun my-ag/setup-buffer (dir)
-  (setq my-ag/buffer (get-buffer-create my-ag/buffer-name))
-  (with-current-buffer my-ag/buffer
-    (setq default-directory dir)
-    (erase-buffer)
-    (my-ag-mode))
-  (display-buffer my-ag/buffer))
-
-(defun my-ag/run (regex &optional args)
-  (let ((default-directory (buffer-local-value 'default-directory my-ag/buffer))
-        (cmd (list "ag" "--group" "--nocolor" "--hidden")))
-    (when args
-      (nconc cmd (split-string args)))
-    (nconc cmd (list "--" regex))
-    (make-process
-     :name "ag"
-     :buffer my-ag/buffer
-     :filter 'my-ag/filter
-     :command cmd)))
-
-(defun my-ag/project-root ()
-  (condition-case err
-      (let ( backend )
-        (setq backend (vc-responsible-backend default-directory))
-        (if backend
-            (vc-call-backend backend 'root default-directory)
-          default-directory))
-    (error default-directory)))
-
-(defun my-ag/read-regex ()
-  (let* ( (def (when my-ag/regex-history (car my-ag/regex-history)))
-          (part (when def (if (< (length def) 20)
-                              def
-                            (concat (substring def 0 20) "...")))) )
-    (read-string
-     (if part (format "Regex [%s]: " part) "Regex: ")
-     ""  'my-ag/regex-history  def  t)))
-
-(defvar my-ag/extra-history nil)
-
-(defun my-ag/read-extra ()
-  (let* ( (def (when my-ag/extra-history (car my-ag/extra-history)))
-          (part (when def (if (< (length def) 20)
-                              def
-                            (concat (substring def 0 20) "...")))) )
-    (read-string
-     (if part (format "Extra args [%s]: " part) "Extra args: ")
-     ""  'my-ag/extra-history  def  t)))
-
-;;;###autoload
-(defun my-ag (regex &optional args)
-  "Search in 'ag' recursively from VCS root directory and fall to
-current directory if VCS root is not defined."
-  (interactive (if (equal current-prefix-arg '(16))
-                   (list (my-ag/read-regex) (my-ag/read-extra))
-                 (list (my-ag/read-regex))))
-  (my-ag/setup-buffer (if current-prefix-arg default-directory (my-ag/project-root)))
-  (my-ag/run regex args))
-
-;;;###autoload
-(defun my-ag-default-directory (regex)
-  "Search in 'ag' recursively from current directory."
-  (interactive (list (my-ag/read-regex)))
-  (my-ag/setup-buffer default-directory)
-  (my-ag/run regex))
-
-
-(provide 'ag)
-
-;;; ag.el ends here
--- a/autobm.el	Sat Jan 02 00:27:54 2021 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,84 +0,0 @@
-;;; autobm.el --- suggest bookmark name from local context -*- lexical-binding: t -*-
-
-(require 'cl-lib)
-(require 'bookmark)
-(require 'which-func)
-(require 'semantic/find)
-
-(defvar autobm-mode-handlers
-  '((emacs-lisp-mode . (autobm-try-semantic))
-    (semantic-decoration-mode . (autobm-try-semantic))
-    (rst-mode . (autobm-try-word))
-    (t . (autobm-try-which-func autobm-try-thingatpt)))
-  "Alist of handlers by mode. Key is a mojor or minor mode name, or `t' as fallback.
-Value is a no-argument function or a list of such functions,
-which returns string or `nil'.")
-
-(defun autobm-try-which-func ()
-  (which-function))
-
-(defvar autobm-try-thingatpt-things
-  '(symbol url email))
-
-(defun autobm-try-thingatpt ()
-  (cl-some #'thing-at-point autobm-try-thingatpt-things))
-
-(defun autobm-try-word ()
-  (thing-at-point 'word))
-
-(defun autobm-try-line ()
-  (let ( (line (thing-at-point 'line)) )
-    (substring line 0 (min (1- (length line)) 30))))
-
-(defun autobm-get-active-handlers ()
-  (let ( h handlers (modes (list major-mode)) )
-    (dolist (m minor-mode-list)
-      (when (and (boundp m) (symbol-value m))
-        (push m modes)))
-    (push t modes)
-    (dolist (m modes)
-      (setq h (assoc m autobm-mode-handlers))
-      (when h
-        (setq h (cdr h))
-        (cond
-         ((symbolp h)
-          (push h handlers))
-         ((listp h)
-          (setq handlers (append h handlers)))
-         (t (error "autobm-mode-handlers isn't a list or a symbol")))))
-    handlers))
-
-(defvar autobm-try-semantic-type-alist
-  '((variable . "var")
-    (function . "fn")
-    (type . "type")))
-
-(defun autobm-try-semantic ()
-  (let ( (tag (semantic-current-tag)) prefix )
-    (when tag
-      (setq prefix (assoc (cadr tag) autobm-try-semantic-type-alist))
-      (when prefix
-        (format "%s: %s" (cdr prefix) (car tag))))))
-
-(defun autobm-suggest ()
-  "Suggest bookmark name depending on buffer mode and local
-context using `autobm-try-semantic-type-alist'. First checked major
-mode then active minor modes."
-  (let ((result  nil))
-    (catch 'exit
-      (dolist (h (autobm-get-active-handlers))
-        (when (setq result (funcall h))
-          (throw 'exit result))))))
-
-;;;###autoload
-(defun autobm (&optional no-overwrite)
-  (interactive "P")
-  (let ( (name (autobm-suggest)) )
-    (when name
-      (setq name (read-string "Set bookmark: " name bookmark-minibuffer-read-name-map name)))
-    (bookmark-set name no-overwrite)))
-
-;; (global-set-key (kbd "C-x r m") 'autobm)
-
-(provide 'autobm)
-
--- a/debian-doc.el	Sat Jan 02 00:27:54 2021 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,77 +0,0 @@
-;;; debian-doc.el --- Debian doc-base integration with Emacs.
-
-;;; Commentary:
-;;
-
-;;; Code:
-
-(defvar debian-doc-dir "/usr/share/doc-base")
-(defvar debian-doc-buffer-name "*debian-doc*")
-(defvar debian-doc-buffer nil)
-
-(defvar debian-doc-mode-map (make-sparse-keymap))
-
-(defconst debian-doc-font-lock-keywords
-  '(("^[^ ][^:\n]*: " . font-lock-function-name-face)
-    ("^\\(Index\\|Files\\): \\(/.*\\)" 2 font-lock-doc-face)
-    ("^Format: \\(.*\\)" 1 font-lock-type-face)
-    ("^Document: \\(.*\\)" 1 font-lock-keyword-face)))
-
-(defun debian-doc-mode ()
-  "Debian-Doc mode for viewing doc-base information."
-  (kill-all-local-variables)
-  (setq major-mode 'debian-doc-mode
-        mode-name "Debian-Doc")
-  (use-local-map debian-doc-mode-map)
-  (setq font-lock-defaults '((debian-doc-font-lock-keywords) t nil nil nil)))
-
-(defvar debian-doc-completion-list nil)
-
-;;;###autoload
-(defun debian-doc (&optional prefix)
-  "Build Debian-Doc buffer.
-
-With PREFIX force to rebuild buffer from doc-base files."
-  (interactive "P")
-  (when prefix
-    (kill-buffer debian-doc-buffer))
-  (if (buffer-live-p debian-doc-buffer)
-      (switch-to-buffer debian-doc-buffer)
-    (setq debian-doc-completion-list nil)
-    (setq debian-doc-buffer (get-buffer-create debian-doc-buffer-name))
-    (switch-to-buffer debian-doc-buffer)
-    (let ( (coding-system-for-read 'utf-8) )
-      (mapc (lambda (file)
-              (when (file-regular-p file)
-                ;; (with-temp-buffer
-                ;;   (insert-file-contents file))
-                (insert "\n-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-\n\n")
-                (insert-file-contents file)
-                (goto-char (point-max))))
-            (directory-files debian-doc-dir t)))
-    (read-only-mode 1)
-    (debian-doc-mode)
-    (goto-char (point-min))))
-
-;;;###autoload
-(defun debian-doc-visit ()
-  "Prompt for Debian package which represent docs and visit its entry in Debian-oc buffer."
-  (interactive)
-  (let (word start)
-    (debian-doc)
-    (unless debian-doc-completion-list
-      (save-excursion
-        (goto-char (point-min))
-        (while (setq start (search-forward "Document: " nil t))
-          (end-of-line)
-          (push (buffer-substring-no-properties start (point)) debian-doc-completion-list))))
-    (when (setq word (completing-read "Package: " debian-doc-completion-list nil t))
-      (goto-char (point-min))
-      (search-forward (concat "Document: " word) nil t)
-      (recenter-top-bottom))))
-(define-key debian-doc-mode-map (kbd "RET") 'debian-doc-visit-at-point)
-
-
-(provide 'debian-doc)
-
-;;; debian-doc.el ends here
--- a/log4-hi-mode.el	Sat Jan 02 00:27:54 2021 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,92 +0,0 @@
-;;; log4-hi-mode.el --- Syntax highlighting logs keywords.
-
-;;; Commentary:
-;; Used for highlighting ERROR/WARN/INFO like keywords and dates in logs.
-
-;;; Code:
-
-(defgroup log4-hi nil
-  "`log4-hi-mode' mode for highlighting logs."
-  :prefix "log4-hi-"
-  :group 'text)
-
-(defface log4-hi-error-face
-  '((t :inherit error))
-  "Face for critical message."
-  :group 'log4-hi)
-
-(defface log4-hi-warn-face
-  '((t :inherit warning))
-  "Face for urgent message."
-  :group 'log4-hi)
-
-(defface log4-hi-info-face
-  '((t :inherit success))
-  "Face for informational message."
-  :group 'log4-hi)
-
-(defface log4-hi-func-face
-  '((t :inherit font-lock-function-name-face))
-  "Face for functions in trace."
-  :group 'log4-hi)
-
-(defface log4-hi-time-face
-  '((t :inherit font-lock-builtin-face :height 0.7))
-  "Face for time."
-  :group 'log4-hi)
-
-(defface log4-hi-hide-face
-  '((t :inherit shadow :height 0.7 :family "Arial"))
-  "Face for extra text for hiding."
-  :group 'log4-hi)
-
-(defvar log4-hi-keywords
-  '(("FATAL\\|ERROR" . 'log4-hi-error-face)
-    ("WARN\\|SEVERE" . 'log4-hi-warn-face)
-    ("INFO\\|DEBUG\\|TRACE" . 'log4-hi-info-face) ))
-
-(defvar log4-hi-func-keywords
-  '(("^.\\{0,5\\}at [[:alnum:]./]+\\.\\([[:alnum:]$]+\\.[[:alnum:]$<>]+\\)([[:alnum:]]+\\.java:[0-9]+)" 1 'log4-hi-func-face) )
-  "Highlight regex for line from Java stack trace.")
-
-(defvar log4-hi-time-keywords
-  '(("\\(:?\\(:?[0-9]\\{2\\}?[0-9]\\{2\\}.\\)?[0-9]\\{2\\}.[0-9]\\{2\\}.\\|\\<\\)[0-9]?[0-9]:[0-9][0-9]:[0-9][0-9]\\>\\(:?[.,][0-9]\\{3,6\\}\\)?" . 'log4-hi-time-face))
-  "Highlight regex for ISO date.")
-
-(defvar log4-hi-hide-regex
-  '(("\\[`.\\{3,100\\}`]" . 'log4-hi-hide-face))
-  "Highlight regex for extra text for hiding.")
-
-(defvar log4-hi-func t
-  "Mark to use hilighting of function names in stacktraces. Currently only Java supported.")
-
-(defvar log4-hi-mode-map (make-sparse-keymap)
-  "Keymap for `log4-hi-mode'.")
-
-;;;###autoload
-(define-minor-mode log4-hi-mode
-  "Highlight standard elements in log4* like log-files."
-  nil " log4-hi" log4-hi-mode-map
-  :global nil
-  (catch 'exit
-    (when log4-hi-mode
-      (font-lock-mode 1)
-      (font-lock-add-keywords nil log4-hi-keywords)
-      (font-lock-add-keywords nil log4-hi-time-keywords)
-      (font-lock-add-keywords nil log4-hi-hide-regex)
-      (when log4-hi-func (font-lock-add-keywords nil log4-hi-func-keywords))
-      (setq prettify-symbols-alist (list (cons "[`" ?$,2'f(B) (cons "`]" ?$,2'g(B)))
-      (prettify-symbols-mode 1)
-      (throw 'exit nil))
-    (font-lock-remove-keywords nil log4-hi-keywords)
-    (font-lock-remove-keywords nil log4-hi-time-keywords)
-    (font-lock-remove-keywords nil log4-hi-func-keywords)
-    (font-lock-remove-keywords nil log4-hi-hide-regex)
-    (prettify-symbols-mode -1))
-  (font-lock-flush))
-
-(provide 'log4-hi-mode)
-
-(provide 'log4-hi-mode)
-
-;;; log4-hi-mode.el ends here
--- a/maven-central.el	Sat Jan 02 00:27:54 2021 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,168 +0,0 @@
-;;; maven-central.el --- Maven central auxility
-
-;;; Commentary:
-;;
-
-(require 'json)
-(require 'url-handlers)
-(require 'maven)
-
-;;; Code:
-
-(defvar maven-central/buffer-name "*Maven Central*")
-
-(defconst maven-central/search-url "http://search.maven.org/solrsearch/select?wt=json&rows=20")
-
-(defun maven-central/versions-url (groupId artifactId)
-  (concat maven-central/search-url "&core=gav&q=g:" (url-hexify-string groupId) (url-hexify-string " AND ") "a:" (url-hexify-string artifactId)))
-;; (maven-central/versions-url "junit" "junit")
-
-(defun maven-central/versions-callback (status)
-  (let ( (buffer (current-buffer)) json )
-    (with-temp-buffer
-      (url-insert buffer)
-      (goto-char (point-min))
-      (setq json (json-read))
-      ;; (switch-to-buffer maven-central/buffer-name)
-      ;; (pp json)
-      (message "Available versions: %s" (mapconcat (lambda (json) (cdr (assq 'v json))) (cdr (assq 'docs (cdr (assoc 'response json)))) ", "))
-      )))
-
-(defun maven-central/versions (groupId artifactId)
-  "Retrieve available versions."
-  (url-retrieve (maven-central/versions-url groupId artifactId) #'maven-central/versions-callback))
-
-(defun maven-central/last-version-url (groupId artifactId)
-  (concat maven-central/search-url "&q=g:" (url-hexify-string groupId) (url-hexify-string " AND ") "a:" (url-hexify-string artifactId)))
-;; (maven-central/versions-url "junit" "junit")
-
-(defun maven-central/last-version-callback (status)
-  (let ( (buffer (current-buffer)) json )
-    (with-temp-buffer
-      (url-insert buffer)
-      (goto-char (point-min))
-      (setq json (json-read))
-      ;; (switch-to-buffer maven-central/buffer-name)
-      ;; (pp json)
-      (message "Latest version: %s" (cdr (assq 'latestVersion (elt (cdr (assq 'docs (cdr (assoc 'response json)))) 0))))
-      )))
-
-(defun maven-central/last-version (groupId artifactId)
-  "Retrieve last package version."
-  (url-retrieve (maven-central/last-version-url groupId artifactId) #'maven-central/last-version-callback))
-
-;;;###autoload
-(defun maven-central-last-version-from-pom ()
-  (interactive)
-  (let (dependency groupId artifactId)
-    (setq dependency (maven/parse-pom-dependency))
-    (setq groupId (elt dependency 0))
-    (setq artifactId (elt dependency 1))
-    (when (and groupId artifactId)
-      (maven-central/last-version groupId artifactId))
-    ))
-
-;;;###autoload
-(defun maven-central-versions-from-pom ()
-  (interactive)
-  (let (dependency groupId artifactId)
-    (setq dependency (maven/parse-pom-dependency))
-    (setq groupId (elt dependency 0))
-    (setq artifactId (elt dependency 1))
-    (when (and groupId artifactId)
-      (maven-central/versions groupId artifactId))
-    ))
-
-(defun ivy/parse-dependency ()
-  (let ( end groupId artifactId )
-    (save-excursion
-      (if (looking-at "[^>]*<dependency ")
-          (progn (search-forward "<") (backward-char))
-        (search-backward "<dependency " nil t))
-      (when (re-search-forward "<dependency [^/]*/>")
-        (setq end (point))
-        (search-backward "<")
-        (save-restriction
-          (narrow-to-region (point) end)
-          (goto-char (point-min))
-          (when (re-search-forward "\\s-org\\s-*=\\s-*['\"]\\([^'\"]+\\)['\"]" nil t)
-            (setq groupId (match-string 1)))
-          (goto-char (point-min))
-          (when (re-search-forward "\\s-name\\s-*=\\s-*['\"]\\([^'\"]+\\)['\"]" nil t)
-            (setq artifactId (match-string 1)))
-          )))
-    (list groupId artifactId)))
-
-;;;###autoload
-(defun maven-central-last-version-from-ivy ()
-  (interactive)
-  (let (dependency groupId artifactId)
-    (setq dependency (ivy/parse-dependency))
-    (setq groupId (elt dependency 0))
-    (setq artifactId (elt dependency 1))
-    (when (and groupId artifactId)
-      (maven-central/last-version groupId artifactId))
-    ))
-
-;;;###autoload
-(defun maven-central-versions-from-ivy ()
-  (interactive)
-  (let (dependency groupId artifactId)
-    (setq dependency (ivy/parse-dependency))
-    (setq groupId (elt dependency 0))
-    (setq artifactId (elt dependency 1))
-    (when (and groupId artifactId)
-      (maven-central/versions groupId artifactId))
-    ))
-
-(defun maven-central/parse-gradle-dependency ()
-  (let ( groupId artifactId )
-    (save-excursion
-      (goto-char (line-beginning-position))
-      (when (re-search-forward "\\([\"']\\)\\([a-zA-Z0-9.-]+\\):\\([a-zA-Z0-9.-]+\\):?[^\"']*\\1" (line-end-position) t)
-        (setq groupId (match-string 2))
-        (setq artifactId (match-string 3))
-        (list groupId artifactId)))))
-
-;;;###autoload
-(defun maven-central-last-version-from-gradle ()
-  (interactive)
-  (let (dependency groupId artifactId)
-    (setq dependency (maven-central/parse-gradle-dependency))
-    (setq groupId (elt dependency 0))
-    (setq artifactId (elt dependency 1))
-    (when (and groupId artifactId)
-      (maven-central/last-version groupId artifactId))
-    ))
-
-;;;###autoload
-(defun maven-central-versions-from-gradle ()
-  (interactive)
-  (let (dependency groupId artifactId)
-    (setq dependency (maven-central/parse-gradle-dependency))
-    (setq groupId (elt dependency 0))
-    (setq artifactId (elt dependency 1))
-    (when (and groupId artifactId)
-      (maven-central/versions groupId artifactId))
-    ))
-
-(defun maven-central/open (groupId artifactId)
-  "Open in Maven Central WEB page info for package."
-  (browse-url (format "https://mvnrepository.com/artifact/%s/%s" groupId artifactId)))
-
-;;;###autoload
-(defun maven-central-open-from-gradle ()
-  (interactive)
-  (let (dependency groupId artifactId)
-    (setq dependency (maven-central/parse-gradle-dependency))
-    (setq groupId (elt dependency 0))
-    (setq artifactId (elt dependency 1))
-    (when (and groupId artifactId)
-      (maven-central/open groupId artifactId))
-    ))
-
-;; (maven-central/last-version "junit" "junit")
-
-(provide 'maven-central)
-
-;;; maven-central.el ends here
--- a/maven.el	Sat Jan 02 00:27:54 2021 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,140 +0,0 @@
-;;; maven.el --- Maven build project helpers.
-
-;;; Commentary:
-;;
-
-;;; Code:
-
-(defvar maven-command "mvn")
-
-(defvar maven/help-buffer-name "*Maven Help*")
-
-(defun maven/parse-pom-dependency-in-region (start end)
-  (let (groupId artifactId version)
-    (save-restriction
-      (narrow-to-region start end)
-      (goto-char start)
-      (re-search-forward "<groupId>\\([^<]*\\)</groupId>" nil t)
-      (setq groupId (match-string-no-properties 1))
-      (goto-char start)
-      (re-search-forward "<artifactId>\\([^<]*\\)</artifactId>" nil t)
-      (setq artifactId (match-string-no-properties 1))
-      (goto-char start)
-      (re-search-forward "<version>\\([^<]*\\)</version>" nil t)
-      (setq version (match-string-no-properties 1))
-      (list groupId artifactId version)
-      )))
-
-(defun maven/parse-pom-dependency (&optional point)
-  (let (start end pos groupId artifactId version fs-o bs-o fs-c bs-c)
-    (save-excursion
-      (if (looking-at "[^>]*<[^!]")
-          (progn (search-forward "<") (backward-char))
-        (search-backward "<"))
-      (setq point (point))
-      (when (re-search-forward "<\\(?:plugin\\|dependency\\)>" nil t)
-        (setq fs-o (re-search-backward "<" nil t)))
-      (goto-char point)
-      (setq bs-o (re-search-backward "<\\(?:plugin\\|dependency\\)>" nil t))
-      (goto-char point)
-      (setq fs-c (re-search-forward "</\\(?:plugin\\|dependency\\)>" nil t))
-      (goto-char point)
-      (when (re-search-backward "</\\(?:plugin\\|dependency\\)>" nil t)
-        (setq bs-c (re-search-forward ">" nil t)))
-      (cond
-       ((and fs-o (= fs-o point) fs-c)
-        (maven/parse-pom-dependency-in-region fs-o fs-c))
-       ((and bs-o (<= bs-o point) fs-c (<= point fs-c))
-        (maven/parse-pom-dependency-in-region bs-o fs-c))
-       ((and fs-o fs-c)
-        (maven/parse-pom-dependency-in-region fs-o fs-c))
-       ((and bs-o bs-c)
-        (maven/parse-pom-dependency-in-region bs-o bs-c))
-       (t
-        (list nil nil nil)))
-      )))
-;; (pp (maven/parse-pom-dependency))
-
-;;;###autoload
-(defun maven-help ()
-  "Run help:describe for plugin at point."
-  (interactive)
-  (let (dependency groupId artifactId)
-    (setq dependency (maven/parse-pom-dependency))
-    (setq groupId (elt dependency 0))
-    (setq artifactId (elt dependency 1))
-    (if (not (and groupId artifactId))
-        (message "Can't find `groupId' or `artifactId'")
-      (shell-command
-       (format "%s help:describe -Ddetail -DgroupId=%s -DartifactId=%s" maven-command groupId artifactId)
-       (switch-to-buffer maven/help-buffer-name)) )
-    ))
-
-;;;###autoload
-(defun maven-effective-pom ()
-  "Run help:effective-pom for plugin at point."
-  (interactive)
-  (shell-command
-   (format "%s help:effective-pom" maven-command)
-   (switch-to-buffer maven/help-buffer-name)) )
-
-;;;###autoload
-(defun maven-effective-settings ()
-  "Run help:effective-settings for plugin at point."
-  (interactive)
-  (shell-command
-   (format "%s help:effective-settings" maven-command)
-   (switch-to-buffer maven/help-buffer-name)) )
-
-;;;###autoload
-(defun maven-dependency-tree ()
-  "Run dependency:tree for plugin at point."
-  (interactive)
-  (shell-command
-   (format "%s dependency:tree" maven-command)
-   (switch-to-buffer maven/help-buffer-name)) )
-
-(defun maven/project-root ()
-  "Root of project."
-  (let ( (dir default-directory) (found nil) )
-    (while (and (not found) (> (length dir) 5))
-      (when (file-exists-p (concat dir "/pom.xml"))
-        (setq found dir))
-      (setq dir (expand-file-name (concat dir "/.."))))
-    found))
-
-(defun maven/file-package ()
-  "Return file package."
-  (save-excursion
-    (goto-char (point-min))
-    (let (pkg cls)
-      (re-search-forward "package +\\([[:alnum:]_.]+\\) *;" nil t)
-      (setq pkg (match-string-no-properties 1))
-      (re-search-forward "class\\s +\\([[:alnum:]_]+\\)\\(\\s \\|\n\\|implements [^{]*\\|extents [^{]*\\)*{" nil t)
-      (setq cls (match-string-no-properties 1))
-      (when (and pkg cls)
-        (concat pkg "." cls))) ))
-
-;;;###autoload
-(defun maven-run-file ()
-  "Run exec:java for current file."
-  (interactive)
-  (let* ( (default-directory (concat (maven/project-root) "/")) )
-    (if (not default-directory)
-        (message "Can't find maven project root")
-      (compilation-start
-       (format "%s exec:java -Dexec.mainClass=%s" maven-command (maven/file-package))))))
-
-;;;###autoload
-(defun maven-run-test ()
-  "Run test -Dtest=... for current file."
-  (interactive)
-  (let* ( (default-directory (concat (maven/project-root) "/")) )
-    (if (not default-directory)
-        (message "Can't find maven project root")
-      (compilation-start
-       (format "%s test -Dtest=%s" maven-command (maven/file-package))))))
-
-(provide 'maven)
-
-;;; maven.el ends here
--- a/my-log-mode.el	Sat Jan 02 00:27:54 2021 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,72 +0,0 @@
-;;; my-log-mode.el --- major mode for error logs
-
-;; Copyright (C) 2010 by Oleksandr Gavenko <gavenkoa@gmail.com>
-
-;; You can do anything with this file without any warranty.
-
-;; Author: Oleksandr Gavenko <gavenkoa@gmail.com>
-;; Maintainer: Oleksandr Gavenko <gavenkoa@gmail.com>
-;; Created: 2011-02-09
-;; Version: 0.1
-;; Keywords: logging
-
-;;; Commentary:
-;;
-;; Very pure release.
-
-;;; Code:
-
-(defun my-log-goto (point)
-  "Visit file according to error specification at POINT."
-  (interactive "d")
-  (let ( start stop line fname fline (fregex "^\\([^:]+\\):\\([[:digit:]]+\\):") )
-    (save-excursion
-      (move-beginning-of-line 1)
-      (setq start (point))
-      (move-end-of-line 1)
-      (setq stop (point))
-      (setq line (filter-buffer-substring start stop))
-      (string-match fregex line)
-      (setq fname (match-string 1 line))
-      (when fname
-        (setq fline (string-to-number (match-string 2 line))))
-      )
-    (cond
-     ( (and fname (file-exists-p fname))
-       (find-file-other-window fname)
-       (goto-char (point-min))
-       (forward-line (1- fline)) )
-     ( t
-       (if fname
-           (message "File '%s' is not found (default directory is '%s')." fname default-directory)
-         (message "No file under current line.") ) )
-     )
-    ))
-
-(defvar my-log-mode-map (make-sparse-keymap))
-(define-key my-log-mode-map (kbd "RET") 'my-log-goto)
-
-(require 'generic-x)
-
-;;;###autoload
-(define-generic-mode
-  'my-log-mode
-  nil
-  nil
-  '(
-    ("^\\([^:]+\\):\\([[:digit:]]+\\):[^
-]+$" (1 font-lock-function-name-face) (2 font-lock-type-face))
-    ("^\\([^:]\\{1,10\\}\\):[^
-]+$" (1 font-lock-keyword-face))
-    )
-  ;; '("\\.log$")
-  nil
-  (list
-   (lambda nil
-     (use-local-map my-log-mode-map)
-     (modify-syntax-entry ?' ".")
-     (modify-syntax-entry ?\" ".")
-     ))
-  )
-
-;;; my-log-mode.el ends here
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mylisp/ag.el	Sat Jan 02 00:33:04 2021 +0200
@@ -0,0 +1,144 @@
+;;; ag.el --- Ag frontend
+
+;;; Commentary:
+;;
+
+(defgroup my-ag nil
+  "My own ag search front-end."
+  :prefix "my-ag"
+  :group 'tools
+  :group 'processes)
+
+(defun my-ag-goto ()
+  (interactive)
+  (save-excursion
+    (let ( lineno end )
+      (forward-line 1)
+      (backward-char 1)
+      (setq end (point))
+      (forward-line 0)
+      (if (not (search-forward-regexp "^\\([1-9][0-9]*\\)[:-]" end t))
+          (message "Not at line number...")
+        (setq lineno (string-to-number (match-string 1)))
+        (if (search-backward-regexp "^$" nil t)
+            (forward-char)
+          (goto-char (point-min)))
+        (search-forward-regexp "^.*")
+        (find-file-other-window (match-string 0))
+        (goto-char (point-min))
+        (forward-line (1- lineno))))))
+
+(defun my-ag-kill-process ()
+  (interactive)
+  (let ( (proc (get-buffer-process (current-buffer))) )
+    (if proc
+	(interrupt-process proc)
+      (error "The %s process is not running" (downcase mode-name)))))
+
+(defvar my-ag-mode-map (make-sparse-keymap))
+
+(define-key my-ag-mode-map (kbd "RET") 'my-ag-goto)
+(define-key my-ag-mode-map (kbd "C-c C-k") 'my-ag-kill-process)
+
+(defface my-ag/lineno-face
+  '((t :inherit warning))
+  "Face for line number."
+  :group 'my-ag)
+(defface my-ag/path-face
+  '((t :inherit success))
+  "Face for line number."
+  :group 'my-ag)
+
+(defvar my-ag/keywords
+  '(("^[1-9][0-9]\\{0,5\\}[-:]" . (0 'my-ag/lineno-face))
+    ("^[^:]\\{6\\}.*" . (0 'my-ag/path-face))))
+
+(define-derived-mode my-ag-mode fundamental-mode "Ag"
+  "Major mode for Ag parsing."
+  (setq font-lock-defaults '(my-ag/keywords t nil nil)) ;  (font-lock-multiline . t)
+  (use-local-map my-ag-mode-map))
+
+(defvar my-ag/buffer-name "*ag*")
+(defvar my-ag/buffer nil)
+
+(defun my-ag/filter (proc str)
+  (when (buffer-live-p (process-buffer proc))
+    (with-current-buffer (process-buffer proc)
+      (save-excursion
+        (goto-char (process-mark proc))
+        (insert str)
+        (set-marker (process-mark proc) (point)))
+      )))
+
+(defvar my-ag/regex-history nil)
+
+(defun my-ag/setup-buffer (dir)
+  (setq my-ag/buffer (get-buffer-create my-ag/buffer-name))
+  (with-current-buffer my-ag/buffer
+    (setq default-directory dir)
+    (erase-buffer)
+    (my-ag-mode))
+  (display-buffer my-ag/buffer))
+
+(defun my-ag/run (regex &optional args)
+  (let ((default-directory (buffer-local-value 'default-directory my-ag/buffer))
+        (cmd (list "ag" "--group" "--nocolor" "--hidden")))
+    (when args
+      (nconc cmd (split-string args)))
+    (nconc cmd (list "--" regex))
+    (make-process
+     :name "ag"
+     :buffer my-ag/buffer
+     :filter 'my-ag/filter
+     :command cmd)))
+
+(defun my-ag/project-root ()
+  (condition-case err
+      (let ( backend )
+        (setq backend (vc-responsible-backend default-directory))
+        (if backend
+            (vc-call-backend backend 'root default-directory)
+          default-directory))
+    (error default-directory)))
+
+(defun my-ag/read-regex ()
+  (let* ( (def (when my-ag/regex-history (car my-ag/regex-history)))
+          (part (when def (if (< (length def) 20)
+                              def
+                            (concat (substring def 0 20) "...")))) )
+    (read-string
+     (if part (format "Regex [%s]: " part) "Regex: ")
+     ""  'my-ag/regex-history  def  t)))
+
+(defvar my-ag/extra-history nil)
+
+(defun my-ag/read-extra ()
+  (let* ( (def (when my-ag/extra-history (car my-ag/extra-history)))
+          (part (when def (if (< (length def) 20)
+                              def
+                            (concat (substring def 0 20) "...")))) )
+    (read-string
+     (if part (format "Extra args [%s]: " part) "Extra args: ")
+     ""  'my-ag/extra-history  def  t)))
+
+;;;###autoload
+(defun my-ag (regex &optional args)
+  "Search in 'ag' recursively from VCS root directory and fall to
+current directory if VCS root is not defined."
+  (interactive (if (equal current-prefix-arg '(16))
+                   (list (my-ag/read-regex) (my-ag/read-extra))
+                 (list (my-ag/read-regex))))
+  (my-ag/setup-buffer (if current-prefix-arg default-directory (my-ag/project-root)))
+  (my-ag/run regex args))
+
+;;;###autoload
+(defun my-ag-default-directory (regex)
+  "Search in 'ag' recursively from current directory."
+  (interactive (list (my-ag/read-regex)))
+  (my-ag/setup-buffer default-directory)
+  (my-ag/run regex))
+
+
+(provide 'ag)
+
+;;; ag.el ends here
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mylisp/autobm.el	Sat Jan 02 00:33:04 2021 +0200
@@ -0,0 +1,84 @@
+;;; autobm.el --- suggest bookmark name from local context -*- lexical-binding: t -*-
+
+(require 'cl-lib)
+(require 'bookmark)
+(require 'which-func)
+(require 'semantic/find)
+
+(defvar autobm-mode-handlers
+  '((emacs-lisp-mode . (autobm-try-semantic))
+    (semantic-decoration-mode . (autobm-try-semantic))
+    (rst-mode . (autobm-try-word))
+    (t . (autobm-try-which-func autobm-try-thingatpt)))
+  "Alist of handlers by mode. Key is a mojor or minor mode name, or `t' as fallback.
+Value is a no-argument function or a list of such functions,
+which returns string or `nil'.")
+
+(defun autobm-try-which-func ()
+  (which-function))
+
+(defvar autobm-try-thingatpt-things
+  '(symbol url email))
+
+(defun autobm-try-thingatpt ()
+  (cl-some #'thing-at-point autobm-try-thingatpt-things))
+
+(defun autobm-try-word ()
+  (thing-at-point 'word))
+
+(defun autobm-try-line ()
+  (let ( (line (thing-at-point 'line)) )
+    (substring line 0 (min (1- (length line)) 30))))
+
+(defun autobm-get-active-handlers ()
+  (let ( h handlers (modes (list major-mode)) )
+    (dolist (m minor-mode-list)
+      (when (and (boundp m) (symbol-value m))
+        (push m modes)))
+    (push t modes)
+    (dolist (m modes)
+      (setq h (assoc m autobm-mode-handlers))
+      (when h
+        (setq h (cdr h))
+        (cond
+         ((symbolp h)
+          (push h handlers))
+         ((listp h)
+          (setq handlers (append h handlers)))
+         (t (error "autobm-mode-handlers isn't a list or a symbol")))))
+    handlers))
+
+(defvar autobm-try-semantic-type-alist
+  '((variable . "var")
+    (function . "fn")
+    (type . "type")))
+
+(defun autobm-try-semantic ()
+  (let ( (tag (semantic-current-tag)) prefix )
+    (when tag
+      (setq prefix (assoc (cadr tag) autobm-try-semantic-type-alist))
+      (when prefix
+        (format "%s: %s" (cdr prefix) (car tag))))))
+
+(defun autobm-suggest ()
+  "Suggest bookmark name depending on buffer mode and local
+context using `autobm-try-semantic-type-alist'. First checked major
+mode then active minor modes."
+  (let ((result  nil))
+    (catch 'exit
+      (dolist (h (autobm-get-active-handlers))
+        (when (setq result (funcall h))
+          (throw 'exit result))))))
+
+;;;###autoload
+(defun autobm (&optional no-overwrite)
+  (interactive "P")
+  (let ( (name (autobm-suggest)) )
+    (when name
+      (setq name (read-string "Set bookmark: " name bookmark-minibuffer-read-name-map name)))
+    (bookmark-set name no-overwrite)))
+
+;; (global-set-key (kbd "C-x r m") 'autobm)
+
+(provide 'autobm)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mylisp/debian-doc.el	Sat Jan 02 00:33:04 2021 +0200
@@ -0,0 +1,77 @@
+;;; debian-doc.el --- Debian doc-base integration with Emacs.
+
+;;; Commentary:
+;;
+
+;;; Code:
+
+(defvar debian-doc-dir "/usr/share/doc-base")
+(defvar debian-doc-buffer-name "*debian-doc*")
+(defvar debian-doc-buffer nil)
+
+(defvar debian-doc-mode-map (make-sparse-keymap))
+
+(defconst debian-doc-font-lock-keywords
+  '(("^[^ ][^:\n]*: " . font-lock-function-name-face)
+    ("^\\(Index\\|Files\\): \\(/.*\\)" 2 font-lock-doc-face)
+    ("^Format: \\(.*\\)" 1 font-lock-type-face)
+    ("^Document: \\(.*\\)" 1 font-lock-keyword-face)))
+
+(defun debian-doc-mode ()
+  "Debian-Doc mode for viewing doc-base information."
+  (kill-all-local-variables)
+  (setq major-mode 'debian-doc-mode
+        mode-name "Debian-Doc")
+  (use-local-map debian-doc-mode-map)
+  (setq font-lock-defaults '((debian-doc-font-lock-keywords) t nil nil nil)))
+
+(defvar debian-doc-completion-list nil)
+
+;;;###autoload
+(defun debian-doc (&optional prefix)
+  "Build Debian-Doc buffer.
+
+With PREFIX force to rebuild buffer from doc-base files."
+  (interactive "P")
+  (when prefix
+    (kill-buffer debian-doc-buffer))
+  (if (buffer-live-p debian-doc-buffer)
+      (switch-to-buffer debian-doc-buffer)
+    (setq debian-doc-completion-list nil)
+    (setq debian-doc-buffer (get-buffer-create debian-doc-buffer-name))
+    (switch-to-buffer debian-doc-buffer)
+    (let ( (coding-system-for-read 'utf-8) )
+      (mapc (lambda (file)
+              (when (file-regular-p file)
+                ;; (with-temp-buffer
+                ;;   (insert-file-contents file))
+                (insert "\n-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-\n\n")
+                (insert-file-contents file)
+                (goto-char (point-max))))
+            (directory-files debian-doc-dir t)))
+    (read-only-mode 1)
+    (debian-doc-mode)
+    (goto-char (point-min))))
+
+;;;###autoload
+(defun debian-doc-visit ()
+  "Prompt for Debian package which represent docs and visit its entry in Debian-oc buffer."
+  (interactive)
+  (let (word start)
+    (debian-doc)
+    (unless debian-doc-completion-list
+      (save-excursion
+        (goto-char (point-min))
+        (while (setq start (search-forward "Document: " nil t))
+          (end-of-line)
+          (push (buffer-substring-no-properties start (point)) debian-doc-completion-list))))
+    (when (setq word (completing-read "Package: " debian-doc-completion-list nil t))
+      (goto-char (point-min))
+      (search-forward (concat "Document: " word) nil t)
+      (recenter-top-bottom))))
+(define-key debian-doc-mode-map (kbd "RET") 'debian-doc-visit-at-point)
+
+
+(provide 'debian-doc)
+
+;;; debian-doc.el ends here
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mylisp/log4-hi-mode.el	Sat Jan 02 00:33:04 2021 +0200
@@ -0,0 +1,92 @@
+;;; log4-hi-mode.el --- Syntax highlighting logs keywords.
+
+;;; Commentary:
+;; Used for highlighting ERROR/WARN/INFO like keywords and dates in logs.
+
+;;; Code:
+
+(defgroup log4-hi nil
+  "`log4-hi-mode' mode for highlighting logs."
+  :prefix "log4-hi-"
+  :group 'text)
+
+(defface log4-hi-error-face
+  '((t :inherit error))
+  "Face for critical message."
+  :group 'log4-hi)
+
+(defface log4-hi-warn-face
+  '((t :inherit warning))
+  "Face for urgent message."
+  :group 'log4-hi)
+
+(defface log4-hi-info-face
+  '((t :inherit success))
+  "Face for informational message."
+  :group 'log4-hi)
+
+(defface log4-hi-func-face
+  '((t :inherit font-lock-function-name-face))
+  "Face for functions in trace."
+  :group 'log4-hi)
+
+(defface log4-hi-time-face
+  '((t :inherit font-lock-builtin-face :height 0.7))
+  "Face for time."
+  :group 'log4-hi)
+
+(defface log4-hi-hide-face
+  '((t :inherit shadow :height 0.7 :family "Arial"))
+  "Face for extra text for hiding."
+  :group 'log4-hi)
+
+(defvar log4-hi-keywords
+  '(("FATAL\\|ERROR" . 'log4-hi-error-face)
+    ("WARN\\|SEVERE" . 'log4-hi-warn-face)
+    ("INFO\\|DEBUG\\|TRACE" . 'log4-hi-info-face) ))
+
+(defvar log4-hi-func-keywords
+  '(("^.\\{0,5\\}at [[:alnum:]./]+\\.\\([[:alnum:]$]+\\.[[:alnum:]$<>]+\\)([[:alnum:]]+\\.java:[0-9]+)" 1 'log4-hi-func-face) )
+  "Highlight regex for line from Java stack trace.")
+
+(defvar log4-hi-time-keywords
+  '(("\\(:?\\(:?[0-9]\\{2\\}?[0-9]\\{2\\}.\\)?[0-9]\\{2\\}.[0-9]\\{2\\}.\\|\\<\\)[0-9]?[0-9]:[0-9][0-9]:[0-9][0-9]\\>\\(:?[.,][0-9]\\{3,6\\}\\)?" . 'log4-hi-time-face))
+  "Highlight regex for ISO date.")
+
+(defvar log4-hi-hide-regex
+  '(("\\[`.\\{3,100\\}`]" . 'log4-hi-hide-face))
+  "Highlight regex for extra text for hiding.")
+
+(defvar log4-hi-func t
+  "Mark to use hilighting of function names in stacktraces. Currently only Java supported.")
+
+(defvar log4-hi-mode-map (make-sparse-keymap)
+  "Keymap for `log4-hi-mode'.")
+
+;;;###autoload
+(define-minor-mode log4-hi-mode
+  "Highlight standard elements in log4* like log-files."
+  nil " log4-hi" log4-hi-mode-map
+  :global nil
+  (catch 'exit
+    (when log4-hi-mode
+      (font-lock-mode 1)
+      (font-lock-add-keywords nil log4-hi-keywords)
+      (font-lock-add-keywords nil log4-hi-time-keywords)
+      (font-lock-add-keywords nil log4-hi-hide-regex)
+      (when log4-hi-func (font-lock-add-keywords nil log4-hi-func-keywords))
+      (setq prettify-symbols-alist (list (cons "[`" ?$,2'f(B) (cons "`]" ?$,2'g(B)))
+      (prettify-symbols-mode 1)
+      (throw 'exit nil))
+    (font-lock-remove-keywords nil log4-hi-keywords)
+    (font-lock-remove-keywords nil log4-hi-time-keywords)
+    (font-lock-remove-keywords nil log4-hi-func-keywords)
+    (font-lock-remove-keywords nil log4-hi-hide-regex)
+    (prettify-symbols-mode -1))
+  (font-lock-flush))
+
+(provide 'log4-hi-mode)
+
+(provide 'log4-hi-mode)
+
+;;; log4-hi-mode.el ends here
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mylisp/maven-central.el	Sat Jan 02 00:33:04 2021 +0200
@@ -0,0 +1,168 @@
+;;; maven-central.el --- Maven central auxility
+
+;;; Commentary:
+;;
+
+(require 'json)
+(require 'url-handlers)
+(require 'maven)
+
+;;; Code:
+
+(defvar maven-central/buffer-name "*Maven Central*")
+
+(defconst maven-central/search-url "http://search.maven.org/solrsearch/select?wt=json&rows=20")
+
+(defun maven-central/versions-url (groupId artifactId)
+  (concat maven-central/search-url "&core=gav&q=g:" (url-hexify-string groupId) (url-hexify-string " AND ") "a:" (url-hexify-string artifactId)))
+;; (maven-central/versions-url "junit" "junit")
+
+(defun maven-central/versions-callback (status)
+  (let ( (buffer (current-buffer)) json )
+    (with-temp-buffer
+      (url-insert buffer)
+      (goto-char (point-min))
+      (setq json (json-read))
+      ;; (switch-to-buffer maven-central/buffer-name)
+      ;; (pp json)
+      (message "Available versions: %s" (mapconcat (lambda (json) (cdr (assq 'v json))) (cdr (assq 'docs (cdr (assoc 'response json)))) ", "))
+      )))
+
+(defun maven-central/versions (groupId artifactId)
+  "Retrieve available versions."
+  (url-retrieve (maven-central/versions-url groupId artifactId) #'maven-central/versions-callback))
+
+(defun maven-central/last-version-url (groupId artifactId)
+  (concat maven-central/search-url "&q=g:" (url-hexify-string groupId) (url-hexify-string " AND ") "a:" (url-hexify-string artifactId)))
+;; (maven-central/versions-url "junit" "junit")
+
+(defun maven-central/last-version-callback (status)
+  (let ( (buffer (current-buffer)) json )
+    (with-temp-buffer
+      (url-insert buffer)
+      (goto-char (point-min))
+      (setq json (json-read))
+      ;; (switch-to-buffer maven-central/buffer-name)
+      ;; (pp json)
+      (message "Latest version: %s" (cdr (assq 'latestVersion (elt (cdr (assq 'docs (cdr (assoc 'response json)))) 0))))
+      )))
+
+(defun maven-central/last-version (groupId artifactId)
+  "Retrieve last package version."
+  (url-retrieve (maven-central/last-version-url groupId artifactId) #'maven-central/last-version-callback))
+
+;;;###autoload
+(defun maven-central-last-version-from-pom ()
+  (interactive)
+  (let (dependency groupId artifactId)
+    (setq dependency (maven/parse-pom-dependency))
+    (setq groupId (elt dependency 0))
+    (setq artifactId (elt dependency 1))
+    (when (and groupId artifactId)
+      (maven-central/last-version groupId artifactId))
+    ))
+
+;;;###autoload
+(defun maven-central-versions-from-pom ()
+  (interactive)
+  (let (dependency groupId artifactId)
+    (setq dependency (maven/parse-pom-dependency))
+    (setq groupId (elt dependency 0))
+    (setq artifactId (elt dependency 1))
+    (when (and groupId artifactId)
+      (maven-central/versions groupId artifactId))
+    ))
+
+(defun ivy/parse-dependency ()
+  (let ( end groupId artifactId )
+    (save-excursion
+      (if (looking-at "[^>]*<dependency ")
+          (progn (search-forward "<") (backward-char))
+        (search-backward "<dependency " nil t))
+      (when (re-search-forward "<dependency [^/]*/>")
+        (setq end (point))
+        (search-backward "<")
+        (save-restriction
+          (narrow-to-region (point) end)
+          (goto-char (point-min))
+          (when (re-search-forward "\\s-org\\s-*=\\s-*['\"]\\([^'\"]+\\)['\"]" nil t)
+            (setq groupId (match-string 1)))
+          (goto-char (point-min))
+          (when (re-search-forward "\\s-name\\s-*=\\s-*['\"]\\([^'\"]+\\)['\"]" nil t)
+            (setq artifactId (match-string 1)))
+          )))
+    (list groupId artifactId)))
+
+;;;###autoload
+(defun maven-central-last-version-from-ivy ()
+  (interactive)
+  (let (dependency groupId artifactId)
+    (setq dependency (ivy/parse-dependency))
+    (setq groupId (elt dependency 0))
+    (setq artifactId (elt dependency 1))
+    (when (and groupId artifactId)
+      (maven-central/last-version groupId artifactId))
+    ))
+
+;;;###autoload
+(defun maven-central-versions-from-ivy ()
+  (interactive)
+  (let (dependency groupId artifactId)
+    (setq dependency (ivy/parse-dependency))
+    (setq groupId (elt dependency 0))
+    (setq artifactId (elt dependency 1))
+    (when (and groupId artifactId)
+      (maven-central/versions groupId artifactId))
+    ))
+
+(defun maven-central/parse-gradle-dependency ()
+  (let ( groupId artifactId )
+    (save-excursion
+      (goto-char (line-beginning-position))
+      (when (re-search-forward "\\([\"']\\)\\([a-zA-Z0-9.-]+\\):\\([a-zA-Z0-9.-]+\\):?[^\"']*\\1" (line-end-position) t)
+        (setq groupId (match-string 2))
+        (setq artifactId (match-string 3))
+        (list groupId artifactId)))))
+
+;;;###autoload
+(defun maven-central-last-version-from-gradle ()
+  (interactive)
+  (let (dependency groupId artifactId)
+    (setq dependency (maven-central/parse-gradle-dependency))
+    (setq groupId (elt dependency 0))
+    (setq artifactId (elt dependency 1))
+    (when (and groupId artifactId)
+      (maven-central/last-version groupId artifactId))
+    ))
+
+;;;###autoload
+(defun maven-central-versions-from-gradle ()
+  (interactive)
+  (let (dependency groupId artifactId)
+    (setq dependency (maven-central/parse-gradle-dependency))
+    (setq groupId (elt dependency 0))
+    (setq artifactId (elt dependency 1))
+    (when (and groupId artifactId)
+      (maven-central/versions groupId artifactId))
+    ))
+
+(defun maven-central/open (groupId artifactId)
+  "Open in Maven Central WEB page info for package."
+  (browse-url (format "https://mvnrepository.com/artifact/%s/%s" groupId artifactId)))
+
+;;;###autoload
+(defun maven-central-open-from-gradle ()
+  (interactive)
+  (let (dependency groupId artifactId)
+    (setq dependency (maven-central/parse-gradle-dependency))
+    (setq groupId (elt dependency 0))
+    (setq artifactId (elt dependency 1))
+    (when (and groupId artifactId)
+      (maven-central/open groupId artifactId))
+    ))
+
+;; (maven-central/last-version "junit" "junit")
+
+(provide 'maven-central)
+
+;;; maven-central.el ends here
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mylisp/maven.el	Sat Jan 02 00:33:04 2021 +0200
@@ -0,0 +1,140 @@
+;;; maven.el --- Maven build project helpers.
+
+;;; Commentary:
+;;
+
+;;; Code:
+
+(defvar maven-command "mvn")
+
+(defvar maven/help-buffer-name "*Maven Help*")
+
+(defun maven/parse-pom-dependency-in-region (start end)
+  (let (groupId artifactId version)
+    (save-restriction
+      (narrow-to-region start end)
+      (goto-char start)
+      (re-search-forward "<groupId>\\([^<]*\\)</groupId>" nil t)
+      (setq groupId (match-string-no-properties 1))
+      (goto-char start)
+      (re-search-forward "<artifactId>\\([^<]*\\)</artifactId>" nil t)
+      (setq artifactId (match-string-no-properties 1))
+      (goto-char start)
+      (re-search-forward "<version>\\([^<]*\\)</version>" nil t)
+      (setq version (match-string-no-properties 1))
+      (list groupId artifactId version)
+      )))
+
+(defun maven/parse-pom-dependency (&optional point)
+  (let (start end pos groupId artifactId version fs-o bs-o fs-c bs-c)
+    (save-excursion
+      (if (looking-at "[^>]*<[^!]")
+          (progn (search-forward "<") (backward-char))
+        (search-backward "<"))
+      (setq point (point))
+      (when (re-search-forward "<\\(?:plugin\\|dependency\\)>" nil t)
+        (setq fs-o (re-search-backward "<" nil t)))
+      (goto-char point)
+      (setq bs-o (re-search-backward "<\\(?:plugin\\|dependency\\)>" nil t))
+      (goto-char point)
+      (setq fs-c (re-search-forward "</\\(?:plugin\\|dependency\\)>" nil t))
+      (goto-char point)
+      (when (re-search-backward "</\\(?:plugin\\|dependency\\)>" nil t)
+        (setq bs-c (re-search-forward ">" nil t)))
+      (cond
+       ((and fs-o (= fs-o point) fs-c)
+        (maven/parse-pom-dependency-in-region fs-o fs-c))
+       ((and bs-o (<= bs-o point) fs-c (<= point fs-c))
+        (maven/parse-pom-dependency-in-region bs-o fs-c))
+       ((and fs-o fs-c)
+        (maven/parse-pom-dependency-in-region fs-o fs-c))
+       ((and bs-o bs-c)
+        (maven/parse-pom-dependency-in-region bs-o bs-c))
+       (t
+        (list nil nil nil)))
+      )))
+;; (pp (maven/parse-pom-dependency))
+
+;;;###autoload
+(defun maven-help ()
+  "Run help:describe for plugin at point."
+  (interactive)
+  (let (dependency groupId artifactId)
+    (setq dependency (maven/parse-pom-dependency))
+    (setq groupId (elt dependency 0))
+    (setq artifactId (elt dependency 1))
+    (if (not (and groupId artifactId))
+        (message "Can't find `groupId' or `artifactId'")
+      (shell-command
+       (format "%s help:describe -Ddetail -DgroupId=%s -DartifactId=%s" maven-command groupId artifactId)
+       (switch-to-buffer maven/help-buffer-name)) )
+    ))
+
+;;;###autoload
+(defun maven-effective-pom ()
+  "Run help:effective-pom for plugin at point."
+  (interactive)
+  (shell-command
+   (format "%s help:effective-pom" maven-command)
+   (switch-to-buffer maven/help-buffer-name)) )
+
+;;;###autoload
+(defun maven-effective-settings ()
+  "Run help:effective-settings for plugin at point."
+  (interactive)
+  (shell-command
+   (format "%s help:effective-settings" maven-command)
+   (switch-to-buffer maven/help-buffer-name)) )
+
+;;;###autoload
+(defun maven-dependency-tree ()
+  "Run dependency:tree for plugin at point."
+  (interactive)
+  (shell-command
+   (format "%s dependency:tree" maven-command)
+   (switch-to-buffer maven/help-buffer-name)) )
+
+(defun maven/project-root ()
+  "Root of project."
+  (let ( (dir default-directory) (found nil) )
+    (while (and (not found) (> (length dir) 5))
+      (when (file-exists-p (concat dir "/pom.xml"))
+        (setq found dir))
+      (setq dir (expand-file-name (concat dir "/.."))))
+    found))
+
+(defun maven/file-package ()
+  "Return file package."
+  (save-excursion
+    (goto-char (point-min))
+    (let (pkg cls)
+      (re-search-forward "package +\\([[:alnum:]_.]+\\) *;" nil t)
+      (setq pkg (match-string-no-properties 1))
+      (re-search-forward "class\\s +\\([[:alnum:]_]+\\)\\(\\s \\|\n\\|implements [^{]*\\|extents [^{]*\\)*{" nil t)
+      (setq cls (match-string-no-properties 1))
+      (when (and pkg cls)
+        (concat pkg "." cls))) ))
+
+;;;###autoload
+(defun maven-run-file ()
+  "Run exec:java for current file."
+  (interactive)
+  (let* ( (default-directory (concat (maven/project-root) "/")) )
+    (if (not default-directory)
+        (message "Can't find maven project root")
+      (compilation-start
+       (format "%s exec:java -Dexec.mainClass=%s" maven-command (maven/file-package))))))
+
+;;;###autoload
+(defun maven-run-test ()
+  "Run test -Dtest=... for current file."
+  (interactive)
+  (let* ( (default-directory (concat (maven/project-root) "/")) )
+    (if (not default-directory)
+        (message "Can't find maven project root")
+      (compilation-start
+       (format "%s test -Dtest=%s" maven-command (maven/file-package))))))
+
+(provide 'maven)
+
+;;; maven.el ends here
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mylisp/my-log-mode.el	Sat Jan 02 00:33:04 2021 +0200
@@ -0,0 +1,72 @@
+;;; my-log-mode.el --- major mode for error logs
+
+;; Copyright (C) 2010 by Oleksandr Gavenko <gavenkoa@gmail.com>
+
+;; You can do anything with this file without any warranty.
+
+;; Author: Oleksandr Gavenko <gavenkoa@gmail.com>
+;; Maintainer: Oleksandr Gavenko <gavenkoa@gmail.com>
+;; Created: 2011-02-09
+;; Version: 0.1
+;; Keywords: logging
+
+;;; Commentary:
+;;
+;; Very pure release.
+
+;;; Code:
+
+(defun my-log-goto (point)
+  "Visit file according to error specification at POINT."
+  (interactive "d")
+  (let ( start stop line fname fline (fregex "^\\([^:]+\\):\\([[:digit:]]+\\):") )
+    (save-excursion
+      (move-beginning-of-line 1)
+      (setq start (point))
+      (move-end-of-line 1)
+      (setq stop (point))
+      (setq line (filter-buffer-substring start stop))
+      (string-match fregex line)
+      (setq fname (match-string 1 line))
+      (when fname
+        (setq fline (string-to-number (match-string 2 line))))
+      )
+    (cond
+     ( (and fname (file-exists-p fname))
+       (find-file-other-window fname)
+       (goto-char (point-min))
+       (forward-line (1- fline)) )
+     ( t
+       (if fname
+           (message "File '%s' is not found (default directory is '%s')." fname default-directory)
+         (message "No file under current line.") ) )
+     )
+    ))
+
+(defvar my-log-mode-map (make-sparse-keymap))
+(define-key my-log-mode-map (kbd "RET") 'my-log-goto)
+
+(require 'generic-x)
+
+;;;###autoload
+(define-generic-mode
+  'my-log-mode
+  nil
+  nil
+  '(
+    ("^\\([^:]+\\):\\([[:digit:]]+\\):[^
+]+$" (1 font-lock-function-name-face) (2 font-lock-type-face))
+    ("^\\([^:]\\{1,10\\}\\):[^
+]+$" (1 font-lock-keyword-face))
+    )
+  ;; '("\\.log$")
+  nil
+  (list
+   (lambda nil
+     (use-local-map my-log-mode-map)
+     (modify-syntax-entry ?' ".")
+     (modify-syntax-entry ?\" ".")
+     ))
+  )
+
+;;; my-log-mode.el ends here
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mylisp/mypasshide.el	Sat Jan 02 00:33:04 2021 +0200
@@ -0,0 +1,33 @@
+
+(defvar mypasshide-prefix-re "^pass: *")
+
+(defun mypasshide--toggle-display (overlay hide)
+  "Hide or reveal region. Signature follows convention for
+`reveal-toggle-invisible' from `reveal' mode."
+  (if hide
+      (overlay-put overlay 'display (propertize "****" 'face 'warning))
+    (overlay-put overlay 'display nil)))
+
+(defun mypasshide--hide ()
+  (save-excursion
+    (goto-char (point-min))
+    (while (re-search-forward mypasshide-prefix-re nil t)
+      (let* ((beg (match-end 0))
+             (end (line-end-position))
+             (overlay (make-overlay beg end)))
+        (mypasshide--toggle-display overlay t)
+        (overlay-put overlay 'reveal-toggle-invisible #'mypasshide--toggle-display)
+        ))))
+
+;;;###autoload
+(define-minor-mode mypasshide-mode
+  "Hide passwords after `mypasshide-prefix-re' and activate
+`reveal-mode'. Disabling is not implemented."
+  :group 'reveal
+  (if mypasshide-mode
+      (progn
+        (mypasshide--hide)
+        (reveal-mode))))
+
+(provide 'mypasshide)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mylisp/pypi.el	Sat Jan 02 00:33:04 2021 +0200
@@ -0,0 +1,41 @@
+;;; pypi.el --- Handle work with Python pypi site.
+
+;;; Commentary:
+;;
+
+(require 'url-handlers)
+(require 'thingatpt)
+
+(eval-when-compile
+  (defvar url-http-response-status))
+
+;;; Code:
+
+(defvar pypi/buffer-name "*Pip*")
+
+(defvar pypi/pkg-history nil)
+
+(defvar pypi/url "https://pypi.python.org/pypi/%s/json")
+
+(defun pypi/pkg-callback (status)
+  (let ( (buffer (current-buffer)) content-type status )
+    (setq content-type (mail-fetch-field "Content-Type"))
+    (setq status url-http-response-status)
+    (switch-to-buffer pypi/buffer-name)
+    (erase-buffer)
+    (url-insert buffer)
+    (fundamental-mode)
+    (when (and (eq status 200) (string-match "application/json" content-type))
+      (js-mode))))
+
+;;;###autoload
+(defun pypi-pkg (pkg)
+  (interactive (list
+                (read-string "Python package: "
+                             (if (region-active-p) (buffer-substring (mark) (point)) (thing-at-point 'symbol))
+                             'pypi/pkg-history)))
+  (url-retrieve (format pypi/url pkg) #'pypi/pkg-callback))
+
+(provide 'pypi)
+
+;;; pypi.el ends here
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mylisp/spring-actuator.el	Sat Jan 02 00:33:04 2021 +0200
@@ -0,0 +1,33 @@
+
+(require 'json)
+(require 'js)
+
+(defvar spring-actuator-server-history nil)
+(defvar spring-actuator-last-server "http://localhost:8080")
+(defvar spring-actuator-path-history nil)
+(defvar spring-actuator-path-completion
+  '("actuator" "auditevents" "autoconfig" "beans" "configprops" "dump" "env" "features" "flyway" "health" "heapdump"
+    "info" "jolokia" "liquibase" "logfile" "loggers" "mappings" "metrics" "trace"))
+
+;;;###autoload
+(defun spring-actuator (server path)
+  (interactive (list (read-string "Server: " spring-actuator-last-server 'spring-actuator-server-history)
+                     (completing-read "Path: " spring-actuator-path-completion nil nil "" 'spring-actuator-path-history)))
+  (setq spring-actuator-last-server server)
+  (let ( (bufname (format "actuator: %s" path)) )
+    (when (get-buffer bufname)
+      (kill-buffer bufname))
+    (switch-to-buffer (url-retrieve-synchronously (format "%s/%s" server path)))
+    (rename-buffer bufname)
+    (goto-char (point-min))
+    (re-search-forward "^$" nil 'move)
+    (forward-char)
+    (delete-region (point-min) (point))
+    (json-pretty-print-buffer)
+    (goto-char (point-min))
+    (if (fboundp 'json-mode)
+        (json-mode)
+      (js-mode))
+    (setq-local js-indent-level 2)))
+
+(provide 'spring-actuator)
--- a/mypasshide.el	Sat Jan 02 00:27:54 2021 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,33 +0,0 @@
-
-(defvar mypasshide-prefix-re "^pass: *")
-
-(defun mypasshide--toggle-display (overlay hide)
-  "Hide or reveal region. Signature follows convention for
-`reveal-toggle-invisible' from `reveal' mode."
-  (if hide
-      (overlay-put overlay 'display (propertize "****" 'face 'warning))
-    (overlay-put overlay 'display nil)))
-
-(defun mypasshide--hide ()
-  (save-excursion
-    (goto-char (point-min))
-    (while (re-search-forward mypasshide-prefix-re nil t)
-      (let* ((beg (match-end 0))
-             (end (line-end-position))
-             (overlay (make-overlay beg end)))
-        (mypasshide--toggle-display overlay t)
-        (overlay-put overlay 'reveal-toggle-invisible #'mypasshide--toggle-display)
-        ))))
-
-;;;###autoload
-(define-minor-mode mypasshide-mode
-  "Hide passwords after `mypasshide-prefix-re' and activate
-`reveal-mode'. Disabling is not implemented."
-  :group 'reveal
-  (if mypasshide-mode
-      (progn
-        (mypasshide--hide)
-        (reveal-mode))))
-
-(provide 'mypasshide)
-
--- a/pypi.el	Sat Jan 02 00:27:54 2021 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,41 +0,0 @@
-;;; pypi.el --- Handle work with Python pypi site.
-
-;;; Commentary:
-;;
-
-(require 'url-handlers)
-(require 'thingatpt)
-
-(eval-when-compile
-  (defvar url-http-response-status))
-
-;;; Code:
-
-(defvar pypi/buffer-name "*Pip*")
-
-(defvar pypi/pkg-history nil)
-
-(defvar pypi/url "https://pypi.python.org/pypi/%s/json")
-
-(defun pypi/pkg-callback (status)
-  (let ( (buffer (current-buffer)) content-type status )
-    (setq content-type (mail-fetch-field "Content-Type"))
-    (setq status url-http-response-status)
-    (switch-to-buffer pypi/buffer-name)
-    (erase-buffer)
-    (url-insert buffer)
-    (fundamental-mode)
-    (when (and (eq status 200) (string-match "application/json" content-type))
-      (js-mode))))
-
-;;;###autoload
-(defun pypi-pkg (pkg)
-  (interactive (list
-                (read-string "Python package: "
-                             (if (region-active-p) (buffer-substring (mark) (point)) (thing-at-point 'symbol))
-                             'pypi/pkg-history)))
-  (url-retrieve (format pypi/url pkg) #'pypi/pkg-callback))
-
-(provide 'pypi)
-
-;;; pypi.el ends here
--- a/spring-actuator.el	Sat Jan 02 00:27:54 2021 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,33 +0,0 @@
-
-(require 'json)
-(require 'js)
-
-(defvar spring-actuator-server-history nil)
-(defvar spring-actuator-last-server "http://localhost:8080")
-(defvar spring-actuator-path-history nil)
-(defvar spring-actuator-path-completion
-  '("actuator" "auditevents" "autoconfig" "beans" "configprops" "dump" "env" "features" "flyway" "health" "heapdump"
-    "info" "jolokia" "liquibase" "logfile" "loggers" "mappings" "metrics" "trace"))
-
-;;;###autoload
-(defun spring-actuator (server path)
-  (interactive (list (read-string "Server: " spring-actuator-last-server 'spring-actuator-server-history)
-                     (completing-read "Path: " spring-actuator-path-completion nil nil "" 'spring-actuator-path-history)))
-  (setq spring-actuator-last-server server)
-  (let ( (bufname (format "actuator: %s" path)) )
-    (when (get-buffer bufname)
-      (kill-buffer bufname))
-    (switch-to-buffer (url-retrieve-synchronously (format "%s/%s" server path)))
-    (rename-buffer bufname)
-    (goto-char (point-min))
-    (re-search-forward "^$" nil 'move)
-    (forward-char)
-    (delete-region (point-min) (point))
-    (json-pretty-print-buffer)
-    (goto-char (point-min))
-    (if (fboundp 'json-mode)
-        (json-mode)
-      (js-mode))
-    (setq-local js-indent-level 2)))
-
-(provide 'spring-actuator)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upgrade/2.bash	Sat Jan 02 00:33:04 2021 +0200
@@ -0,0 +1,24 @@
+#!/bin/bash
+
+set -x -e
+
+emacsdir=~/.emacs.d
+compatfile=$emacsdir/.emacs-ver
+mylispdir_old=$emacsdir/my
+mylispdir_new=$emacsdir/mylisp
+
+if ! [[ -f $compatfile ]]; then
+    echo 'Cannot detect compatibility.'
+    exit 1
+fi
+read ver <$compatfile
+if [[ $ver != 1 ]]; then
+  echo 'Script is designed only for upgrade: v1 => v2.'
+  exit 1
+fi
+
+rm $mylispdir_old/init.el || :
+mv $mylispdir_old $mylispdir_new || :
+rm $emacsdir/.emacs-my.elc || :
+
+echo 2 >$compatfile