"Fossies" - the Fresh Open Source Software Archive

Member "unicore-ucc-8.0.2/extras/emacs-mode/ucc-output-mode.el" (18 May 2020, 7158 Bytes) of package /linux/misc/unicore-ucc-8.0.2.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Lisp source code syntax highlighting (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file.

    1 ;;; ucc-outout-mode.el --- access ucc from within Emacs
    2 
    3 ;; Copyright (C) 2008 Rebecca Breu, Research Centre Juelich
    4 
    5 ;; Maintainer: 2008 Rebecca Breu, Research Centre Juelich
    6 ;; Keywords: unicore, ucc
    7 ;; Created: 2008-03-31
    8 ;; Modified: 2008-03-31
    9 ;; X-URL: http://www.unicore.eu
   10 
   11 ;;; License
   12 
   13 ;; This program is free software; you can redistribute it and/or
   14 ;; modify it under the terms of the GNU General Public License
   15 ;; as published by the Free Software Foundation; either version 2
   16 ;; of the License, or (at your option) any later version.
   17 
   18 ;; This program is distributed in the hope that it will be useful,
   19 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
   20 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   21 ;; GNU General Public License for more details.
   22 
   23 ;; You should have received a copy of the GNU General Public License
   24 ;; along with this program; if not, write to the Free Software
   25 ;; Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
   26 
   27 (require 'derived)
   28 (require 'custom)
   29 
   30 
   31 (defface ucc-verbose
   32   '((t (:foreground "grey50")))
   33   "Face to use for for ucc's verbose output lines."
   34   :group 'ucc)
   35 
   36 
   37 (defface ucc-emphasize
   38   '((t (:weight bold)))
   39   "Face to use for emphasized phrases."
   40   :group 'ucc)
   41 
   42 
   43 (defface ucc-epr
   44   '((t (:underline t)))
   45   "Face to use for EPRs."
   46   :group 'ucc)
   47 
   48 
   49 (defface ucc-epr-mouse
   50   '((t (:background "darkseagreen2")))
   51   "Face to use for EPRs on mouse-over."
   52   :group 'ucc)
   53 
   54 
   55 (defface ucc-c9m
   56   '((t (:underline t)))
   57   "Face to use for c9m-files."
   58   :group 'ucc)
   59 
   60 
   61 (defface ucc-c9m-mouse
   62   '((t (:background "darkseagreen2")))
   63   "Face to use for c9m-files on mouse-over."
   64   :group 'ucc)
   65 
   66 
   67 (defface ucc-exception 
   68   '((t (:foreground "red" :weight bold)))
   69   "Face to use for exceptions."
   70   :group 'ucc)
   71 
   72 
   73 (defvar ucc-epr-menu
   74   (let ((map (make-sparse-keymap "ucc epr")))
   75     (define-key map [trace-workflow]
   76       '("Trace workflow" . ucc-workflow-trace-at-point))
   77     (define-key map [workflow-info-long]
   78       '("Long workflow info" . ucc-workflow-info-long-at-point))
   79     (define-key map [workflow-info]
   80       '("Workflow info" . ucc-workflow-info-at-point))
   81     (define-key map [workflow-seperator] '("---"))
   82     (define-key map [list-remote-file]
   83       '("List remote dir" . ucc-list-remote-file-at-point))
   84     (define-key map [data-manage-seperator] '("---"))
   85     (define-key map [abort-job] '("Abort job" . ucc-abort-job-at-point))
   86     (define-key map [destroy-job] '("Destroy job" . ucc-destroy-job-at-point))
   87     (define-key map [get-output] '("Get output" . ucc-get-output-at-point))
   88     (define-key map [get-status] '("Get status" . ucc-get-status-at-point))
   89     map)
   90   "Keymap for a clickable end point reference.")
   91 
   92 (defvar ucc-epr-keymap
   93   (let ((map (make-sparse-keymap)))
   94     (define-key map (kbd "C-c a") 'ucc-abort-job-at-point)
   95     (define-key map (kbd "C-c d") 'ucc-destroy-job-at-point)
   96     (define-key map (kbd "C-c o") 'ucc-get-output-at-point)
   97     (define-key map (kbd "C-c s") 'ucc-get-status-at-point)
   98     (define-key map (kbd "C-c n") 'ucc-workflow-info-at-point)
   99     (define-key map (kbd "C-c t") 'ucc-workflow-trace-at-point)
  100     (define-key map (kbd "C-c l") 'ucc-list-remote-file-at-point)
  101     (define-key map [mouse-3] (lambda (event) (interactive "@e")
  102                 (mouse-set-point event)
  103                 (popup-menu ucc-epr-menu)))
  104     map)
  105   "Keymap for a clickable end point reference.")
  106 
  107 (fset 'ucc-epr-keymap ucc-epr-keymap)
  108 
  109 
  110 (defvar ucc-c9m-menu
  111   (let ((map (make-sparse-keymap "ucc c9m file")))
  112     (define-key map [get-file]
  113       '("Get file" . ucc-get-file-at-point))
  114     map)
  115   "Keymap for a clickable c9m file.")
  116 
  117 
  118 (defvar ucc-c9m-keymap
  119   (let ((map (make-sparse-keymap)))
  120     (define-key map (kbd "C-c f") 'ucc-get-file-at-point)
  121     (define-key map [mouse-3] (lambda (event) (interactive "@e")
  122                 (mouse-set-point event)
  123                 (popup-menu ucc-c9m-menu)))
  124     map)
  125   "Keymap for a clickable c9m-file.")
  126 
  127 (fset 'ucc-c9m-keymap ucc-c9m-keymap)
  128 
  129 
  130 (defvar ucc-output-mode-font-lock-keywords
  131   '(("^\\[ucc .*?\\].*" 0 'ucc-verbose)
  132     ("^Applications on target system.*\\|\\<\\(SUCCESSFUL\\|QUEUED\\|NOT SUCCESSFUL\\|ABORTED\\|RUNNING\\)\\>" 0 'ucc-emphasize)
  133     ("\\<\\(https://\\w*\\)" 1 '(face ucc-epr
  134                       mouse-face ucc-epr-mouse
  135                       help-echo "mouse 3: menu"
  136                       keymap ucc-epr-keymap
  137                       field "ucc-epr"))
  138     ("\\<\\(c9m:\\w*\\)" 1 '(face ucc-c9m
  139                    mouse-face ucc-c9m-mouse
  140                    help-echo "mouse 3: menu"
  141                    keymap ucc-c9m-keymap
  142                    field "ucc-c9m"))
  143     ("\\<\\(java\\|org\\|de\\)[.].*?\\(Exception\\|Error\\):?\\>" 0 
  144      'ucc-exception))
  145   "Syntax highlighting of ucc output.")
  146 
  147 
  148 (defvar ucc-output-mode-syntax-table
  149   (let ((table (make-syntax-table)))
  150     (modify-syntax-entry ?_ "w" table)
  151     (modify-syntax-entry ?= "w" table)
  152     (modify-syntax-entry ?. "w" table)
  153     (modify-syntax-entry ?/ "w" table)
  154     (modify-syntax-entry ?\\ "w" table)
  155     (modify-syntax-entry ?- "w" table)
  156     (modify-syntax-entry ?: "w" table)
  157     (modify-syntax-entry ?? "w" table)
  158     table)
  159   "Syntax table for ucc output mode."
  160   )
  161 
  162 
  163 (define-derived-mode ucc-output-mode fundamental-mode
  164   "ucc output"
  165   "Major mode for ucc output.
  166 
  167 This mode is automatically activated in ucc output buffers.
  168 You can right-click on EPRS to get a context menu or perform the
  169 following keybord shortcuts on them:
  170 
  171 \\{ucc-epr-keymap}
  172 "
  173   (make-local-variable 'font-lock-extra-managed-props)
  174   (setq font-lock-extra-managed-props '(mouse-face help-echo keymap field))
  175 
  176   (make-local-variable 'font-lock-defaults)
  177   (setq font-lock-defaults '(ucc-output-mode-font-lock-keywords)))
  178 
  179 
  180 (defun ucc-get-status-at-point ()
  181   "Get status of the job whose EPR is under the cursor."
  182   (interactive)
  183   (ucc-get-status (field-string)))
  184             
  185 (defun ucc-get-output-at-point ()
  186   "Get output of the job whose EPR is under the cursor."
  187   (interactive)
  188   (ucc-get-output (field-string)))
  189                                   
  190 (defun ucc-abort-job-at-point ()
  191   "Abort the job whose EPR is under the cursor."
  192   (interactive)
  193   (ucc-abort-job (field-string)))
  194                                   
  195 (defun ucc-destroy-job-at-point ()
  196   "Abort the job whose EPR is under the cursor."
  197   (interactive)
  198   (ucc-destroy-job (field-string)))
  199                                   
  200 (defun ucc-list-remote-file-at-point ()
  201   "List the remote directory  whose EPR is under the cursor."
  202   (interactive)
  203   (ucc-list-remote-file (field-string)))
  204                                   
  205 (defun ucc-workflow-trace-at-point ()
  206   "Trace the workflow whose EPR is under the cursor."
  207   (interactive)
  208   (ucc-workflow-trace (field-string)))
  209                                   
  210 (defun ucc-get-file-at-point (dest)
  211   "Get the file whose EPR is under the cursor."
  212   (interactive "FDestination: ")
  213   (ucc-get-file (field-string) dest))
  214 
  215 (defun ucc-workflow-info-at-point ()
  216   "List workflow whose EPR is under the cursor."
  217   (interactive)
  218   (ucc-start-process 'ucc-output-mode "workflow-info" "-l"
  219              (format "\"%s\"" (field-string))))
  220 
  221 (defun ucc-workflow-info-long-at-point ()
  222   "List workflow whose EPR is under the cursor."
  223   (interactive)
  224   (ucc-start-process 'ucc-output-mode "workflow-info" "-l" "-a"
  225              (format "\"%s\"" (field-string))))
  226 
  227 (provide 'ucc-output-mode)