"Fossies" - the Fresh Open Source Software Archive

Member "unicore-ucc-8.0.2/extras/emacs-mode/ucc-localfilelist-mode.el" (18 May 2020, 3200 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-localfilelist-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 
   28 (require 'derived)
   29 (require 'custom)
   30 
   31 
   32 (defface ucc-localfile
   33   '((t (:underline t)))
   34   "Face to use for local files."
   35   :group 'ucc)
   36 
   37 
   38 (defface ucc-localfile-mouse
   39   '((t (:background "darkseagreen2")))
   40   "Face to use for local files on mouse-over."
   41   :group 'ucc)
   42 
   43 
   44 (defvar ucc-localfile-menu
   45   (let ((map (make-sparse-keymap "ucc local file")))
   46     (define-key map [open-file-other-window]
   47       '("Open file other window" . ucc-open-local-file-other-window))
   48     (define-key map [open-file] '("Open file" . ucc-open-local-file))
   49     map)
   50   "Keymap for a clickable local file.")
   51 
   52 
   53 (defvar ucc-localfile-keymap
   54   (let ((map (make-sparse-keymap)))
   55     (define-key map (kbd "C-c f") 'ucc-open-local-file)
   56     (define-key map (kbd "C-c o") 'ucc-open-local-file-other-window)
   57     (define-key map [mouse-3] (lambda (event) (interactive "@e")
   58                 (mouse-set-point event)
   59                 (popup-menu ucc-localfile-menu)))
   60     map)
   61   "Keymap for a clickable local file.")
   62     
   63 (fset 'ucc-localfile-keymap ucc-localfile-keymap)
   64 
   65 
   66 (defvar ucc-localfilelist-mode-font-lock-keywords
   67   '(("^\\([a-zA-Z]:\\|[./]\\)\\w*" 0 '(face ucc-localfile
   68                           mouse-face ucc-localfile-mouse
   69                           help-echo "mouse-3: menu"
   70                           keymap ucc-localfile-keymap
   71                           field "ucc-localfile")))
   72   "Highlighting of local file names."
   73   )
   74 
   75 
   76 (define-derived-mode ucc-localfilelist-mode ucc-output-mode
   77   "ucc output"
   78   "Major mode for ucc output.
   79 
   80 This mode is automatically activated in ucc output buffers.
   81 
   82 You can right-click on EPRS to get a context menu or perform the
   83 following keybord shortcuts on them:
   84 
   85 \\{ucc-epr-keymap}
   86 
   87 You can right-click on local file names to get a context menu or perform the
   88 following keybord shortcuts on them:
   89 
   90 \\{ucc-localfile-keymap}
   91 
   92 "
   93 
   94   (setq font-lock-defaults (list (append
   95                   ucc-output-mode-font-lock-keywords
   96                   ucc-localfilelist-mode-font-lock-keywords))))
   97 
   98 
   99 (defun ucc-open-local-file ()
  100 "Open the file under the cursor."
  101 (interactive)
  102   (find-file (field-string)))
  103 
  104 
  105 (defun ucc-open-local-file-other-window ()
  106 "Open the file under the cursor in other window."
  107   (interactive)
  108   (find-file-other-window (field-string)))
  109 
  110 
  111 (provide 'ucc-localfilelist-mode)