From ad2ff6466dfedffda2a14b6106268573f02841de Mon Sep 17 00:00:00 2001 From: RainMark Date: Wed, 25 Nov 2020 23:25:33 +0800 Subject: [PATCH] add all projects lookup support, upgrade to version 0.0.2 Signed-off-by: RainMark --- README.org | 2 ++ opengrok-restful.el | 48 +++++++++++++++++++++++++++---------------- opengrok-restful.gif | Bin 10707663 -> 28276910 bytes opengrok-restful.png | Bin 2493578 -> 1918004 bytes 4 files changed, 32 insertions(+), 18 deletions(-) diff --git a/README.org b/README.org index 84d8280..ffbc21d 100644 --- a/README.org +++ b/README.org @@ -47,6 +47,8 @@ (global-set-key (kbd "M-p") 'opengrok-restful-lookup-path) #+end_src + - When you lookup symbol with opengrok-restful, Input nothing to lookup all projects that indexed, Input 'c' to lookup current project. + [[./opengrok-restful.gif]] [[./opengrok-restful.png]] diff --git a/opengrok-restful.el b/opengrok-restful.el index 2e5c847..5415fb9 100644 --- a/opengrok-restful.el +++ b/opengrok-restful.el @@ -5,7 +5,7 @@ ;; Author: RainMark ;; URL: https://github.com/RainMark/opengrok-restful.el ;; Package-Requires: ((emacs "24.4")) -;; Version: 0.0.1 +;; Version: 0.0.2 ;; This file is NOT part of GNU Emacs. @@ -95,33 +95,45 @@ (cdr (assoc 'results data))) (put-text-property (point-min) (point-max) 'keymap opengrok-restful-keymap) (setq buffer-read-only t) - (if (< 0 (buffer-size)) - (progn - (switch-to-buffer-other-window opengrok-restful-buffer) - (goto-char (point-min))) - (message "Nothing found.")) + (when (< 0 (buffer-size)) + (progn + (switch-to-buffer-other-window opengrok-restful-buffer) + (goto-char (point-min)))) )) -(defun opengrok-restful-project-lookup (project type value) +(defun opengrok-restful-project-lookup (request-params) (request opengrok-restful-url - :type "GET" - :params `(("projects" . ,project) (,type . ,value)) - :parser 'json-read - :sync t - :complete (cl-function (lambda (&key data &allow-other-keys) - (opengrok-restful-parse-response data))))) + :type "GET" + :params request-params + :parser 'json-read + :sync t + :complete (cl-function (lambda (&key data &allow-other-keys) + (opengrok-restful-parse-response data))))) + +(defun opengrok-restful-current-project-name () + (file-name-nondirectory (directory-file-name (projectile-project-root)))) + +(defun opengrok-restful-make-params (project type value) + (let ((params `((,type ,value)))) + (if (not (string= "" project)) + (cons `("projects" . ,(if (string= "c" project) + (opengrok-restful-current-project-name) + project)) + params) + params))) (defmacro opengrok-restful-define-lookup (type) (let ((fun (intern (format "opengrok-restful-lookup-%s" type)))) `(defun ,fun () (interactive) - (let ((default-project (file-name-nondirectory (directory-file-name (projectile-project-root)))) Internal Server Error - opengrok-restful - Oxfs Git Repo

500


Gitea Version: 1.15.7