(defconst idlwave-shell-halt-messages-re
- (mapconcat 'identity idlwave-shell-halt-messages "\\|")
+ (mapconcat #'identity idlwave-shell-halt-messages "\\|")
"The regular expression computed from `idlwave-shell-halt-messages'.")
(defconst idlwave-shell-trace-message-re
"[ \t\n]*\\'"))
(when idlwave-shell-query-for-class
- (add-to-list (make-local-variable 'idlwave-determine-class-special)
- 'idlwave-shell-get-object-class)
+ (add-hook 'idlwave-determine-class-functions
+ #'idlwave-shell-get-object-class nil t)
(setq idlwave-store-inquired-class t))
;; Make sure comint-last-input-end does not go to beginning of
(setq idlwave-shell-default-directory default-directory)
(setq idlwave-shell-hide-output nil)
- (add-hook 'kill-buffer-hook 'idlwave-shell-kill-shell-buffer-confirm
+ (add-hook 'kill-buffer-hook #'idlwave-shell-kill-shell-buffer-confirm
nil 'local)
- (add-hook 'kill-buffer-hook 'idlwave-shell-delete-temp-files nil 'local)
- (add-hook 'kill-emacs-hook 'idlwave-shell-delete-temp-files)
+ (add-hook 'kill-buffer-hook #'idlwave-shell-delete-temp-files nil 'local)
+ (add-hook 'kill-emacs-hook #'idlwave-shell-delete-temp-files)
;; Set the optional comint variables
(when idlwave-shell-comint-settings
(set (make-local-variable (car entry)) (cdr entry)))))
- (unless (memq 'comint-carriage-motion
+ (unless (memq #'comint-carriage-motion
(default-value 'comint-output-filter-functions))
;; Strip those pesky ctrl-m's.
(add-hook 'comint-output-filter-functions
(while (search-forward "\r" pmark t)
(delete-region (point) (line-beginning-position)))))))
'append 'local)
- (add-hook 'comint-output-filter-functions 'comint-strip-ctrl-m nil 'local))
+ (add-hook 'comint-output-filter-functions #'comint-strip-ctrl-m nil 'local))
;; Python-mode, bundled with many Emacs installs, quite cavalierly
;; adds this function to the global default hook. It interferes
;; with overlay-arrows.
- (remove-hook 'comint-output-filter-functions 'py-pdbtrack-track-stack-file)
+ ;; FIXME: We should fix this interference rather than globally turn it off.
+ (when (fboundp 'py-pdbtrack-track-stack-file)
+ (remove-hook 'comint-output-filter-functions
+ #'py-pdbtrack-track-stack-file))
;; IDLWAVE syntax, and turn on abbreviations
(set (make-local-variable 'comment-start) ";")
(setq abbrev-mode t)
- (add-hook 'post-command-hook 'idlwave-command-hook nil t)
+ (add-hook 'post-command-hook #'idlwave-command-hook nil t)
;; Read the command history?
(when (and idlwave-shell-save-command-history
(setq idlwave-path-alist old-path-alist))))
(if (not (fboundp 'idl-shell))
- (fset 'idl-shell 'idlwave-shell))
+ (defalias 'idl-shell #'idlwave-shell))
(defvar idlwave-shell-idl-wframe nil
"Frame for displaying the IDL shell window.")
(and idlwave-shell-use-dedicated-frame
(setq idlwave-shell-idl-wframe (selected-frame)))
(add-hook 'idlwave-shell-sentinel-hook
- 'save-buffers-kill-emacs t))
+ #'save-buffers-kill-emacs t))
;; A non-nil arg means, we want a dedicated frame. This will last
;; for the current editing session.
;; Check if the process still exists. If not, create it.
(unless (comint-check-proc (idlwave-shell-buffer))
(let* ((prg (or idlwave-shell-explicit-file-name "idl"))
- (buf (apply 'make-comint
+ (buf (apply #'make-comint
idlwave-shell-process-name prg nil
(if (stringp idlwave-shell-command-line-options)
(idlwave-split-string
idlwave-shell-command-line-options)))
(process (get-buffer-process buf)))
(setq idlwave-idlwave_routine_info-compiled nil)
- (set-process-filter process 'idlwave-shell-filter)
- (set-process-sentinel process 'idlwave-shell-sentinel)
+ (set-process-filter process #'idlwave-shell-filter)
+ (set-process-sentinel process #'idlwave-shell-sentinel)
(set-buffer buf)
(idlwave-shell-mode)))
(let ((window (idlwave-display-buffer (idlwave-shell-buffer) nil
(setq idlwave-shell-char-mode-active 'exit))
((string-match (nth 1 idlwave-shell-input-mode-spells) string)
;; Set a timer which will soon start the character loop
- (if (fboundp 'start-itimer)
- (start-itimer "IDLWAVE Char Mode" 'idlwave-shell-char-mode-loop 0.5
- nil nil t 'no-error)
- (run-at-time 0.5 nil 'idlwave-shell-char-mode-loop 'no-error)))))
+ (run-at-time 0.5 nil #'idlwave-shell-char-mode-loop 'no-error))))
(defvar keyboard-quit)
(defun idlwave-shell-char-mode-loop (&optional no-error)
(idlwave-shell-move-or-history nil arg))
(define-obsolete-function-alias 'idlwave-shell-comint-filter
- 'comint-output-filter "25.1")
+ #'comint-output-filter "25.1")
(defun idlwave-shell-is-running ()
"Return t if the shell process is running."
proc filtered))))))
;; Call the post-command hook
- (if (listp idlwave-shell-post-command-hook)
- (progn
- ;;(message "Calling list")
- ;;(prin1 idlwave-shell-post-command-hook)
- (eval idlwave-shell-post-command-hook))
- ;;(message "Calling command function")
- (funcall idlwave-shell-post-command-hook))
+ (if (functionp idlwave-shell-post-command-hook)
+ ;;(message "Calling command function")
+ (funcall idlwave-shell-post-command-hook)
+ ;;(message "Calling list")
+ ;;(prin1 idlwave-shell-post-command-hook)
+ (eval idlwave-shell-post-command-hook t))
;; Reset to default state for next command.
;; Also we do not want to find this prompt again.
(if bp
(let ((cmd (idlwave-shell-bp-get bp 'cmd)))
(if cmd ;; Execute any breakpoint command
- (if (listp cmd) (eval cmd) (funcall cmd))))
+ (if (functionp cmd) (funcall cmd) (eval cmd t))))
;; A breakpoint that we did not know about - perhaps it was
;; set by the user... Let's update our list.
(idlwave-shell-bp-query)))
(interactive "P")
(let ((n (if n (prefix-numeric-value n) 0)))
(idlwave-shell-send-command
- (apply 'format "window,%d,xs=%d,ys=%d"
+ (apply #'format "window,%d,xs=%d,ys=%d"
n idlwave-shell-graphics-window-size)
nil (idlwave-shell-hide-p 'misc) nil t)))
(while (string-match "^PATH:[ \t]*<\\(.*\\)>[ \t]*\n" path-string start)
(push (match-string 1 path-string) dirs)
(setq start (match-end 0)))
- (setq dirs (mapcar 'file-name-as-directory dirs))
+ (setq dirs (mapcar #'file-name-as-directory dirs))
(if (string-match "^SYSDIR:[ \t]*<\\(.*\\)>[ \t]*\n" path-string)
(setq sysdir (file-name-as-directory
(match-string 1 path-string))))
key (nth 4 specs)
keys (if (and (stringp key)
(not (string-match "\\` *\\'" key)))
- (mapcar 'list
+ (mapcar #'list
(delete "" (idlwave-split-string key " +")))))
(setq name (idlwave-sintern-routine-or-method name class t)
class (idlwave-sintern-class class t)
file (if (equal file "") nil file)
keys (mapcar (lambda (x)
- (list (idlwave-sintern-keyword (car x) t))) keys))
+ (list (idlwave-sintern-keyword (car x) t)))
+ keys))
;; In the following ignore routines already defined in buffers,
;; assuming that if the buffer stuff differs, it is a "new"
(match-string 1 idlwave-shell-command-output)))))
(defvar idlwave-sint-sysvars nil)
-(idlwave-new-sintern-type 'execcomm)
+(idlwave-new-sintern-type execcomm)
(defun idlwave-shell-complete (&optional arg)
"Do completion in the idlwave-shell buffer.
(defun idlwave-shell-parse-stack-and-display ()
(let* ((lines (delete "" (idlwave-split-string
idlwave-shell-command-output "^%")))
- (stack (delq nil (mapcar 'idlwave-shell-parse-line lines)))
+ (stack (delq nil (mapcar #'idlwave-shell-parse-line lines)))
(nmax (1- (length stack)))
(nmin 0) message)
(cond
(interactive "P")
(idlwave-shell-print arg 'help))
-(defmacro idlwave-shell-mouse-examine (help &optional ev)
- "Create a function for generic examination of expressions."
- `(lambda (event)
- "Expansion function for expression examination."
- (interactive "e")
- (let* ((drag-track (fboundp 'mouse-drag-track))
- (transient-mark-mode t)
- (tracker
- ;; Emacs 22 no longer completes the drag with
- ;; mouse-drag-region, without an additional
- ;; event. mouse-drag-track does so.
- (if drag-track 'mouse-drag-track 'mouse-drag-region)))
- (funcall tracker event)
- (idlwave-shell-print (if (region-active-p) '(4) nil)
- ,help ,ev))))
-
-;; Begin terrible hack section -- XEmacs tests for button2 explicitly
-;; on drag events, calling drag-n-drop code if detected. Ughhh...
-(defun idlwave-default-mouse-track-event-is-with-button (_event _n)
- (declare (obsolete nil "28.1"))
- t)
-
-(define-obsolete-function-alias 'idlwave-xemacs-hack-mouse-track 'ignore "27.1")
+(defun idlwave-shell--mouse-examine (event help &optional ev)
+ "Expansion function for expression examination."
+ (let* ((transient-mark-mode t))
+ (mouse-drag-track event)
+ (idlwave-shell-print (if (region-active-p) '(4) nil)
+ help ev)))
+
+(define-obsolete-function-alias
+ 'idlwave-default-mouse-track-event-is-with-button #'always "28.1")
+
+(define-obsolete-function-alias 'idlwave-xemacs-hack-mouse-track
+ #'ignore "27.1")
;;; End terrible hack section
(defun idlwave-shell-mouse-print (event)
"Print value of variable at the mouse position, with `print'."
(interactive "e")
- (funcall (idlwave-shell-mouse-examine nil) event))
+ (idlwave-shell--mouse-examine event nil))
(defun idlwave-shell-mouse-help (event)
"Print value of variable at the mouse position, with `help'."
(interactive "e")
- (funcall (idlwave-shell-mouse-examine 'help) event))
+ (idlwave-shell--mouse-examine event 'help))
(defun idlwave-shell-examine-select (event)
"Pop-up a list to select from for examining the expression."
(interactive "e")
- (funcall (idlwave-shell-mouse-examine nil event) event))
+ (idlwave-shell--mouse-examine event nil event))
(defmacro idlwave-shell-examine (help)
"Create a function for key-driven expression examination."
(setq beg (region-beginning)
end (region-end)))
(t
- (idlwave-with-special-syntax
+ (with-syntax-table idlwave-find-symbol-syntax-table
;; Move to beginning of current or previous expression
(if (looking-at "\\<\\|(")
;; At beginning of expression, don't move backwards unless
(move-overlay idlwave-shell-expression-overlay beg end
(current-buffer))
(add-hook 'pre-command-hook
- 'idlwave-shell-delete-expression-overlay))
+ #'idlwave-shell-delete-expression-overlay))
(add-hook 'pre-command-hook
- 'idlwave-shell-delete-output-overlay)
+ #'idlwave-shell-delete-output-overlay)
;; Remove empty or comment-only lines
(while (string-match "\n[ \t]*\\(;.*\\)?\r*\n" expr)
;; "Print")
(idlwave-popup-select
ev
- (mapcar 'car idlwave-shell-examine-alist)
+ (mapcar #'car idlwave-shell-examine-alist)
"Examine with"))
idlwave-shell-examine-alist))))
(setq help (cdr help-cons))
"Variable to hold the win/height pairs for all *Examine* windows.")
(defvar idlwave-shell-examine-map (make-sparse-keymap))
-(define-key idlwave-shell-examine-map "q" 'idlwave-shell-examine-display-quit)
-(define-key idlwave-shell-examine-map "c" 'idlwave-shell-examine-display-clear)
-
+(define-key idlwave-shell-examine-map "q" #'idlwave-shell-examine-display-quit)
+(define-key idlwave-shell-examine-map "c" #'idlwave-shell-examine-display-clear)
(defun idlwave-shell-check-compiled-and-display ()
"Check examine output for warning about undefined procedure/function."
count nil condition disabled))))))
(setq idlwave-shell-bp-alist (cdr idlwave-shell-bp-alist))
;; Update breakpoint data
- (if (eq bp-re bp-re54)
- (mapc 'idlwave-shell-update-bp old-bp-alist)
- (mapc 'idlwave-shell-update-bp-command-only old-bp-alist))))
+ (mapc (if (eq bp-re bp-re54)
+ #'idlwave-shell-update-bp
+ #'idlwave-shell-update-bp-command-only)
+ old-bp-alist)))
;; Update the breakpoint overlays
(unless no-show (idlwave-shell-update-bp-overlays))
;; Return the new list
the line number used with the IDL breakpoint command.
Looks for a new breakpoint index number in the list. This is
considered the new breakpoint if the file name of frame matches."
- (let ((obp-index (mapcar 'idlwave-shell-bp-get idlwave-shell-old-bp))
+ (let ((obp-index (mapcar #'idlwave-shell-bp-get idlwave-shell-old-bp))
(bpl idlwave-shell-bp-alist))
(while (and (member (idlwave-shell-bp-get (car bpl)) obp-index)
(setq bpl (cdr bpl))))
(defvar idlwave-shell-debug-line-map (make-sparse-keymap))
(define-key idlwave-shell-debug-line-map [mouse-3]
- 'idlwave-shell-mouse-active-bp)
+ #'idlwave-shell-mouse-active-bp)
(defun idlwave-shell-update-bp-overlays ()
"Update the overlays which mark breakpoints in the source code.
(setq ov-alist idlwave-shell-bp-overlays
idlwave-shell-bp-overlays
(if idlwave-shell-bp-glyph
- (mapcar 'list (mapcar 'car idlwave-shell-bp-glyph))
+ (mapcar #'list (mapcar #'car idlwave-shell-bp-glyph))
(list (list 'bp))))
(while (setq bp (pop bp-list))
(save-excursion
(if help-list
(concat
" - "
- (mapconcat 'identity help-list ", ")))
+ (mapconcat #'identity help-list ", ")))
(if (and (not count) (not condition))
" (use mouse-3 for breakpoint actions)")))
(full-type (if disabled
;;(define-key map "\M-?" 'comint-dynamic-list-completions)
;;(define-key map "\t" 'comint-dynamic-complete)
- (define-key map "\C-w" 'comint-kill-region)
- (define-key map "\t" 'idlwave-shell-complete)
- (define-key map "\M-\t" 'idlwave-shell-complete)
- (define-key map "\C-c\C-s" 'idlwave-shell)
- (define-key map "\C-c?" 'idlwave-routine-info)
- (define-key map "\C-g" 'idlwave-keyboard-quit)
- (define-key map "\M-?" 'idlwave-context-help)
+ (define-key map "\C-w" #'comint-kill-region)
+ (define-key map "\t" #'idlwave-shell-complete)
+ (define-key map "\M-\t" #'idlwave-shell-complete)
+ (define-key map "\C-c\C-s" #'idlwave-shell)
+ (define-key map "\C-c?" #'idlwave-routine-info)
+ (define-key map "\C-g" #'idlwave-keyboard-quit)
+ (define-key map "\M-?" #'idlwave-context-help)
(define-key map [(control meta ?\?)]
- 'idlwave-help-assistant-help-with-topic)
- (define-key map "\C-c\C-i" 'idlwave-update-routine-info)
- (define-key map "\C-c\C-y" 'idlwave-shell-char-mode-loop)
- (define-key map "\C-c\C-x" 'idlwave-shell-send-char)
- (define-key map "\C-c=" 'idlwave-resolve)
- (define-key map "\C-c\C-v" 'idlwave-find-module)
- (define-key map "\C-c\C-k" 'idlwave-kill-autoloaded-buffers)
+ #'idlwave-help-assistant-help-with-topic)
+ (define-key map "\C-c\C-i" #'idlwave-update-routine-info)
+ (define-key map "\C-c\C-y" #'idlwave-shell-char-mode-loop)
+ (define-key map "\C-c\C-x" #'idlwave-shell-send-char)
+ (define-key map "\C-c=" #'idlwave-resolve)
+ (define-key map "\C-c\C-v" #'idlwave-find-module)
+ (define-key map "\C-c\C-k" #'idlwave-kill-autoloaded-buffers)
(define-key map idlwave-shell-prefix-key
- 'idlwave-shell-debug-map)
- (define-key map [(up)] 'idlwave-shell-up-or-history)
- (define-key map [(down)] 'idlwave-shell-down-or-history)
+ #'idlwave-shell-debug-map)
+ (define-key map [(up)] #'idlwave-shell-up-or-history)
+ (define-key map [(down)] #'idlwave-shell-down-or-history)
(define-key idlwave-shell-mode-map [(shift mouse-3)]
- 'idlwave-mouse-context-help)
+ #'idlwave-mouse-context-help)
map)
"Keymap for `idlwave-mode'.")
(defvar idlwave-shell-electric-debug-mode-map
(let ((map (make-sparse-keymap)))
;; A few extras in the electric debug map
- (define-key map " " 'idlwave-shell-step)
- (define-key map "+" 'idlwave-shell-stack-up)
- (define-key map "=" 'idlwave-shell-stack-up)
- (define-key map "-" 'idlwave-shell-stack-down)
- (define-key map "_" 'idlwave-shell-stack-down)
+ (define-key map " " #'idlwave-shell-step)
+ (define-key map "+" #'idlwave-shell-stack-up)
+ (define-key map "=" #'idlwave-shell-stack-up)
+ (define-key map "-" #'idlwave-shell-stack-down)
+ (define-key map "_" #'idlwave-shell-stack-down)
(define-key map "e" (lambda () (interactive) (idlwave-shell-print '(16))))
- (define-key map "q" 'idlwave-shell-retall)
+ (define-key map "q" #'idlwave-shell-retall)
(define-key map "t"
(lambda () (interactive) (idlwave-shell-send-command "help,/TRACE")))
- (define-key map [(control ??)] 'idlwave-shell-electric-debug-help)
+ (define-key map [(control ??)] #'idlwave-shell-electric-debug-help)
(define-key map "x"
(lambda (arg) (interactive "P")
(idlwave-shell-print arg nil nil t)))
map))
(defvar idlwave-shell-mode-prefix-map (make-sparse-keymap))
-(fset 'idlwave-shell-mode-prefix-map idlwave-shell-mode-prefix-map)
+(defalias 'idlwave-shell-mode-prefix-map idlwave-shell-mode-prefix-map)
(defvar idlwave-mode-prefix-map (make-sparse-keymap))
-(fset 'idlwave-mode-prefix-map idlwave-mode-prefix-map)
+(defalias 'idlwave-mode-prefix-map idlwave-mode-prefix-map)
(defun idlwave-shell-define-key-both (key hook)
"Define a key in both the shell and buffer mode maps."
(define-key idlwave-mode-map key hook)
(define-key idlwave-shell-mode-map key hook))
-(define-key idlwave-mode-map "\C-c\C-y" 'idlwave-shell-char-mode-loop)
-(define-key idlwave-mode-map "\C-c\C-x" 'idlwave-shell-send-char)
+(define-key idlwave-mode-map "\C-c\C-y" #'idlwave-shell-char-mode-loop)
+(define-key idlwave-mode-map "\C-c\C-x" #'idlwave-shell-send-char)
;; The mouse bindings for PRINT and HELP
(idlwave-shell-define-key-both [(shift down-mouse-2)]
- 'idlwave-shell-mouse-print)
+ #'idlwave-shell-mouse-print)
(idlwave-shell-define-key-both [(control meta down-mouse-2)]
- 'idlwave-shell-mouse-help)
+ #'idlwave-shell-mouse-help)
(idlwave-shell-define-key-both [(control shift down-mouse-2)]
- 'idlwave-shell-examine-select)
+ #'idlwave-shell-examine-select)
;; We need to turn off the button release events.
-(idlwave-shell-define-key-both [(shift mouse-2)] 'ignore)
-(idlwave-shell-define-key-both [(shift control mouse-2)] 'ignore)
-(idlwave-shell-define-key-both [(control meta mouse-2)] 'ignore)
+(idlwave-shell-define-key-both [(shift mouse-2)] #'ignore)
+(idlwave-shell-define-key-both [(shift control mouse-2)] #'ignore)
+(idlwave-shell-define-key-both [(control meta mouse-2)] #'ignore)
;; The following set of bindings is used to bind the debugging keys.
cmd))))
; Enter the prefix map in two places.
-(fset 'idlwave-debug-map idlwave-mode-prefix-map)
-(fset 'idlwave-shell-debug-map idlwave-shell-mode-prefix-map)
+(defalias 'idlwave-debug-map idlwave-mode-prefix-map)
+(defalias 'idlwave-shell-debug-map idlwave-shell-mode-prefix-map)
;; The Electric Debug Minor Mode --------------------------------------------
(idlwave-toolbar-toggle))
(if idlwave-shell-use-toolbar
- (add-hook 'idlwave-shell-mode-hook 'idlwave-toolbar-add-everywhere))
+ (add-hook 'idlwave-shell-mode-hook #'idlwave-toolbar-add-everywhere))
;;; idlw-shell.el ends here
-;; idlwave.el --- IDL editing mode for GNU Emacs
+;; idlwave.el --- IDL editing mode for GNU Emacs -*- lexical-binding: t; -*-
;; Copyright (C) 1999-2021 Free Software Foundation, Inc.
point. Moving point is useful, for example, to place point between
parentheses of expanded functions.
-See `idlwave-check-abbrev'."
+See `idlwave-modify-abbrev'."
:group 'idlwave-abbrev-and-indent-action
:type 'boolean)
;; Example actions:
;;
;; Capitalize system vars
-;; (idlwave-action-and-binding idlwave-sysvar '(capitalize-word 1) t)
+;; (idlwave-action-and-binding idlwave-sysvar
+;; (lambda (_) (capitalize-word 1)) t)
;;
;; Capitalize procedure name
;; (idlwave-action-and-binding "\\<\\(pro\\|function\\)\\>[ \t]*\\<"
-;; '(capitalize-word 1) t)
+;; (lambda (_) (capitalize-word 1)) t)
;;
;; Capitalize common block name
;; (idlwave-action-and-binding "\\<common\\>[ \t]+\\<"
-;; '(capitalize-word 1) t)
+;; (lambda (_) (capitalize-word 1)) t)
;; Capitalize label
;; (idlwave-action-and-binding (concat "^[ \t]*" idlwave-label)
-;; '(capitalize-word -1) t)
+;; (lambda (_) (capitalize-word 1)) t)
(defvar idlwave-indent-action-table nil
"Associated array containing action lists of search string (car),
"\\<\\(&&\\|and\\|b\\(egin\\|reak\\)\\|c\\(ase\\|o\\(mpile_opt\\|ntinue\\)\\)\\|do\\|e\\(lse\\|nd\\(case\\|else\\|for\\|if\\|rep\\|switch\\|while\\)?\\|q\\)\\|for\\(ward_function\\)?\\|g\\(oto\\|[et]\\)\\|i\\(f\\|nherits\\)\\|l[et]\\|mod\\|n\\(e\\|ot\\)\\|o\\(n_\\(error\\|ioerror\\)\\|[fr]\\)\\|re\\(peat\\|turn\\)\\|switch\\|then\\|until\\|while\\|xor\\|||\\)\\>")
-(let* (;; Procedure declarations. Fontify keyword plus procedure name.
- ;; Function declarations. Fontify keyword plus function name.
- (pros-and-functions
- '("\\<\\(function\\|pro\\)\\>[ \t]+\\(\\sw+\\(::\\sw+\\)?\\)"
- (1 font-lock-keyword-face)
- (2 font-lock-function-name-face nil t)))
-
- ;; Common blocks
- (common-blocks
- '("\\<\\(common\\)\\>[ \t]*\\(\\sw+\\)?[ \t]*,?"
- (1 font-lock-keyword-face) ; "common"
- (2 font-lock-constant-face nil t) ; block name
- ("[ \t]*\\(\\sw+\\)[ ,]*"
- ;; Start with point after block name and comma
- nil nil (1 font-lock-variable-name-face)))) ; variable names
-
- ;; Batch files
- (batch-files
- '("^[ \t]*\\(@[^ \t\n]+\\)" (1 font-lock-string-face)))
-
- ;; Labels
- (label
- '("^[ \t]*\\([a-zA-Z]\\sw*:\\)" (1 font-lock-constant-face)))
-
- ;; The goto statement and its label
- (goto
- '("\\(goto\\)[ \t]*,[ \t]*\\([a-zA-Z]\\sw*\\)"
- (1 font-lock-keyword-face)
- (2 font-lock-constant-face)))
-
- ;; Tags in structure definitions. Note that this definition
- ;; actually collides with labels, so we have to use the same
- ;; face. It also matches named subscript ranges,
- ;; e.g. vec{bottom:top]. No good way around this.
- (structtag
- '("\\<\\([a-zA-Z][a-zA-Z0-9_]*:\\)[^:]" (1 font-lock-constant-face)))
-
- ;; Structure names
- (structname
- '("\\({\\|\\<inherits\\s-\\)\\s-*\\([a-zA-Z][a-zA-Z0-9_]*\\)[},\t \n]"
- (2 font-lock-function-name-face)))
-
- ;; Keyword parameters, like /xlog or ,xrange=[]
- ;; This is anchored to the comma preceding the keyword.
- ;; Treats continuation lines, works only during whole buffer
- ;; fontification. Slow, use it only in fancy fontification.
- (keyword-parameters
- '("\\(,\\|[a-zA-Z0-9_](\\)[ \t]*\\(\\$[ \t]*\\(;.*\\)?\n\\([ \t]*\\(;.*\\)?\n\\)*[ \t]*\\)?\\(/[a-zA-Z_]\\sw*\\|[a-zA-Z_]\\sw*[ \t]*=\\)"
- (6 font-lock-constant-face)))
-
- ;; System variables start with a bang.
- (system-variables
- '("\\(![a-zA-Z_0-9]+\\(\\.\\sw+\\)?\\)"
- (1 font-lock-variable-name-face)))
-
- ;; Special and unusual operators (not used because too noisy)
- ;; (special-operators
- ;; '("[<>#]" (0 font-lock-keyword-face)))
-
- ;; All operators (not used because too noisy)
- ;; (all-operators
- ;; '("[-*^#+<>/]" (0 font-lock-keyword-face)))
-
- ;; Arrows with text property `idlwave-class'
- (class-arrows
- '(idlwave-match-class-arrows (0 idlwave-class-arrow-face))))
+(defmacro idlwave--dlet (binders &rest body)
+ "Like `dlet' but without warnings about non-prefixed var names."
+ (declare (indent 1) (debug let))
+ (let ((vars (mapcar (lambda (binder)
+ (if (consp binder) (car binder) binder))
+ binders)))
+ `(with-suppressed-warnings ((lexical ,@vars))
+ (dlet ,binders ,@body))))
+
+(idlwave--dlet
+ (;; Procedure declarations. Fontify keyword plus procedure name.
+ ;; Function declarations. Fontify keyword plus function name.
+ (pros-and-functions
+ '("\\<\\(function\\|pro\\)\\>[ \t]+\\(\\sw+\\(::\\sw+\\)?\\)"
+ (1 font-lock-keyword-face)
+ (2 font-lock-function-name-face nil t)))
+
+ ;; Common blocks
+ (common-blocks
+ '("\\<\\(common\\)\\>[ \t]*\\(\\sw+\\)?[ \t]*,?"
+ (1 font-lock-keyword-face) ; "common"
+ (2 font-lock-constant-face nil t) ; block name
+ ("[ \t]*\\(\\sw+\\)[ ,]*"
+ ;; Start with point after block name and comma
+ nil nil (1 font-lock-variable-name-face)))) ; variable names
+
+ ;; Batch files
+ (batch-files
+ '("^[ \t]*\\(@[^ \t\n]+\\)" (1 font-lock-string-face)))
+
+ ;; Labels
+ (label
+ '("^[ \t]*\\([a-zA-Z]\\sw*:\\)" (1 font-lock-constant-face)))
+
+ ;; The goto statement and its label
+ (goto
+ '("\\(goto\\)[ \t]*,[ \t]*\\([a-zA-Z]\\sw*\\)"
+ (1 font-lock-keyword-face)
+ (2 font-lock-constant-face)))
+
+ ;; Tags in structure definitions. Note that this definition
+ ;; actually collides with labels, so we have to use the same
+ ;; face. It also matches named subscript ranges,
+ ;; e.g. vec{bottom:top]. No good way around this.
+ (structtag
+ '("\\<\\([a-zA-Z][a-zA-Z0-9_]*:\\)[^:]" (1 font-lock-constant-face)))
+
+ ;; Structure names
+ (structname
+ '("\\({\\|\\<inherits\\s-\\)\\s-*\\([a-zA-Z][a-zA-Z0-9_]*\\)[},\t \n]"
+ (2 font-lock-function-name-face)))
+
+ ;; Keyword parameters, like /xlog or ,xrange=[]
+ ;; This is anchored to the comma preceding the keyword.
+ ;; Treats continuation lines, works only during whole buffer
+ ;; fontification. Slow, use it only in fancy fontification.
+ (keyword-parameters
+ '("\\(,\\|[a-zA-Z0-9_](\\)[ \t]*\\(\\$[ \t]*\\(;.*\\)?\n\\([ \t]*\\(;.*\\)?\n\\)*[ \t]*\\)?\\(/[a-zA-Z_]\\sw*\\|[a-zA-Z_]\\sw*[ \t]*=\\)"
+ (6 font-lock-constant-face)))
+
+ ;; System variables start with a bang.
+ (system-variables
+ '("\\(![a-zA-Z_0-9]+\\(\\.\\sw+\\)?\\)"
+ (1 font-lock-variable-name-face)))
+
+ ;; Special and unusual operators (not used because too noisy)
+ ;; (special-operators
+ ;; '("[<>#]" (0 font-lock-keyword-face)))
+
+ ;; All operators (not used because too noisy)
+ ;; (all-operators
+ ;; '("[-*^#+<>/]" (0 font-lock-keyword-face)))
+
+ ;; Arrows with text property `idlwave-class'
+ (class-arrows
+ '(idlwave-match-class-arrows (0 idlwave-class-arrow-face))))
(defconst idlwave-font-lock-keywords-1
(list pros-and-functions batch-files)
"Subdued level highlighting for IDLWAVE mode.")
(defconst idlwave-font-lock-keywords-2
- (mapcar 'symbol-value idlwave-default-font-lock-items)
+ (mapcar #'symbol-value idlwave-default-font-lock-items)
"Medium level highlighting for IDLWAVE mode.")
(defconst idlwave-font-lock-keywords-3
- (list pros-and-functions
- batch-files
- idlwave-idl-keywords
- label goto
- structtag
- structname
- common-blocks
- keyword-parameters
- system-variables
+ (list pros-and-functions
+ batch-files
+ idlwave-idl-keywords
+ label goto
+ structtag
+ structname
+ common-blocks
+ keyword-parameters
+ system-variables
class-arrows)
"Gaudy level highlighting for IDLWAVE mode."))
(cons 'call (list (concat "\\(" idlwave-variable "\\) *= *"
"\\(" idlwave-method-call "\\s *\\)?"
idlwave-identifier
- "\\s *(") nil))
+ "\\s *(")
+ nil))
(cons 'call (list (concat
"\\(" idlwave-method-call "\\s *\\)?"
idlwave-identifier
- "\\( *\\($\\|\\$\\)\\|\\s *,\\)") nil))
+ "\\( *\\($\\|\\$\\)\\|\\s *,\\)")
+ nil))
(cons 'assign (list (concat
- "\\(" idlwave-variable "\\) *=") nil)))
+ "\\(" idlwave-variable "\\) *=")
+ nil)))
"Associated list of statement matching regular expressions.
Each regular expression matches the start of an IDL statement.
not possible without parsing. Thus assignment statement become just
the leftover unidentified statements containing an equal sign.")
-;; FIXME: This var seems to only ever be set, but never actually used!
-(defvar idlwave-fill-function 'auto-fill-function
- "IDL mode auto fill function.")
-
(defvar idlwave-comment-indent-function 'comment-indent-function
"IDL mode comment indent function.")
(defconst idlwave-mode-version "6.1_em22")
-(defmacro idlwave-keyword-abbrev (&rest args)
- "Creates a function for abbrev hooks to call `idlwave-check-abbrev' with args."
- `(lambda ()
- ,(append '(idlwave-check-abbrev) args)))
-
-;; If I take the time I can replace idlwave-keyword-abbrev with
-;; idlwave-code-abbrev and remove the quoted abbrev check from
-;; idlwave-check-abbrev. Then, e.g, (idlwave-keyword-abbrev 0 t) becomes
-;; (idlwave-code-abbrev idlwave-check-abbrev 0 t). In fact I should change
-;; the name of idlwave-check-abbrev to something like idlwave-modify-abbrev.
-
-(defmacro idlwave-code-abbrev (&rest args)
- "Creates a function for abbrev hooks that ensures abbrevs are not quoted.
-Specifically, if the abbrev is in a comment or string it is unexpanded.
-Otherwise ARGS forms a list that is evaluated."
- ;; FIXME: it would probably be better to rely on the new :enable-function
- ;; to enforce the "don't expand in comments or strings".
- `(lambda ()
- ,(prin1-to-string args) ;; Puts the code in the doc string
- (if (idlwave-quoted)
- (progn (unexpand-abbrev) nil)
- ,(append args))))
+(defun idlwave-keyword-abbrev (&rest args)
+ "Create a function for abbrev hooks to call `idlwave-modify-abbrev' with args."
+ (lambda () (append #'idlwave-modify-abbrev args)))
(autoload 'idlwave-shell "idlw-shell"
"Run an inferior IDL, with I/O through buffer `(idlwave-shell-buffer)'." t)
(autoload 'idlwave-shell-run-region "idlw-shell"
"Compile and run the region." t)
-(fset 'idlwave-debug-map (make-sparse-keymap))
+(defalias 'idlwave-debug-map (make-sparse-keymap))
(defvar idlwave-mode-map
(let ((map (make-sparse-keymap)))
- (define-key map "\C-c " 'idlwave-hard-tab)
- (define-key map [(control tab)] 'idlwave-hard-tab)
- ;;(define-key map "\C-c\C- " 'idlwave-hard-tab)
- (define-key map "'" 'idlwave-show-matching-quote)
- (define-key map "\"" 'idlwave-show-matching-quote)
- (define-key map "\C-g" 'idlwave-keyboard-quit)
- (define-key map "\C-c;" 'idlwave-toggle-comment-region)
- (define-key map "\C-\M-a" 'idlwave-beginning-of-subprogram)
- (define-key map "\C-\M-e" 'idlwave-end-of-subprogram)
- (define-key map "\C-c{" 'idlwave-beginning-of-block)
- (define-key map "\C-c}" 'idlwave-end-of-block)
- (define-key map "\C-c]" 'idlwave-close-block)
- (define-key map [(meta control h)] 'idlwave-mark-subprogram)
- (define-key map "\M-\C-n" 'idlwave-forward-block)
- (define-key map "\M-\C-p" 'idlwave-backward-block)
- (define-key map "\M-\C-d" 'idlwave-down-block)
- (define-key map "\M-\C-u" 'idlwave-backward-up-block)
- (define-key map "\M-\r" 'idlwave-split-line)
- (define-key map "\M-\C-q" 'idlwave-indent-subprogram)
- (define-key map "\C-c\C-p" 'idlwave-previous-statement)
- (define-key map "\C-c\C-n" 'idlwave-next-statement)
- ;; (define-key map "\r" 'idlwave-newline)
- ;; (define-key map "\t" 'idlwave-indent-line)
- (define-key map [(shift iso-lefttab)] 'idlwave-indent-statement)
- (define-key map "\C-c\C-a" 'idlwave-auto-fill-mode)
- (define-key map "\M-q" 'idlwave-fill-paragraph)
- (define-key map "\M-s" 'idlwave-edit-in-idlde)
- (define-key map "\C-c\C-h" 'idlwave-doc-header)
- (define-key map "\C-c\C-m" 'idlwave-doc-modification)
- (define-key map "\C-c\C-c" 'idlwave-case)
- (define-key map "\C-c\C-d" 'idlwave-debug-map)
+ (define-key map "\C-c " #'idlwave-hard-tab)
+ (define-key map [(control tab)] #'idlwave-hard-tab)
+ ;;(define-key map "\C-c\C- " #'idlwave-hard-tab)
+ (define-key map "'" #'idlwave-show-matching-quote)
+ (define-key map "\"" #'idlwave-show-matching-quote)
+ (define-key map "\C-g" #'idlwave-keyboard-quit)
+ (define-key map "\C-c;" #'idlwave-toggle-comment-region)
+ (define-key map "\C-\M-a" #'idlwave-beginning-of-subprogram)
+ (define-key map "\C-\M-e" #'idlwave-end-of-subprogram)
+ (define-key map "\C-c{" #'idlwave-beginning-of-block)
+ (define-key map "\C-c}" #'idlwave-end-of-block)
+ (define-key map "\C-c]" #'idlwave-close-block)
+ (define-key map [(meta control h)] #'idlwave-mark-subprogram)
+ (define-key map "\M-\C-n" #'idlwave-forward-block)
+ (define-key map "\M-\C-p" #'idlwave-backward-block)
+ (define-key map "\M-\C-d" #'idlwave-down-block)
+ (define-key map "\M-\C-u" #'idlwave-backward-up-block)
+ (define-key map "\M-\r" #'idlwave-split-line)
+ (define-key map "\M-\C-q" #'idlwave-indent-subprogram)
+ (define-key map "\C-c\C-p" #'idlwave-previous-statement)
+ (define-key map "\C-c\C-n" #'idlwave-next-statement)
+ ;; (define-key map "\r" #'idlwave-newline)
+ ;; (define-key map "\t" #'idlwave-indent-line)
+ (define-key map [(shift iso-lefttab)] #'idlwave-indent-statement)
+ (define-key map "\C-c\C-a" #'auto-fill-mode)
+ (define-key map "\M-q" #'idlwave-fill-paragraph)
+ (define-key map "\M-s" #'idlwave-edit-in-idlde)
+ (define-key map "\C-c\C-h" #'idlwave-doc-header)
+ (define-key map "\C-c\C-m" #'idlwave-doc-modification)
+ (define-key map "\C-c\C-c" #'idlwave-case)
+ (define-key map "\C-c\C-d" #'idlwave-debug-map)
(when (and (listp idlwave-shell-debug-modifiers)
(not (equal idlwave-shell-debug-modifiers '())))
;; Bind the debug commands also with the special modifiers.
(delq 'shift (copy-sequence idlwave-shell-debug-modifiers))))
(define-key map
(vector (append mods-noshift (list (if shift ?C ?c))))
- 'idlwave-shell-save-and-run)
+ #'idlwave-shell-save-and-run)
(define-key map
(vector (append mods-noshift (list (if shift ?B ?b))))
- 'idlwave-shell-break-here)
+ #'idlwave-shell-break-here)
(define-key map
(vector (append mods-noshift (list (if shift ?E ?e))))
- 'idlwave-shell-run-region)))
- (define-key map "\C-c\C-d\C-c" 'idlwave-shell-save-and-run)
- (define-key map "\C-c\C-d\C-b" 'idlwave-shell-break-here)
- (define-key map "\C-c\C-d\C-e" 'idlwave-shell-run-region)
- (define-key map "\C-c\C-f" 'idlwave-for)
- ;; (define-key map "\C-c\C-f" 'idlwave-function)
- ;; (define-key map "\C-c\C-p" 'idlwave-procedure)
- (define-key map "\C-c\C-r" 'idlwave-repeat)
- (define-key map "\C-c\C-w" 'idlwave-while)
- (define-key map "\C-c\C-k" 'idlwave-kill-autoloaded-buffers)
- (define-key map "\C-c\C-s" 'idlwave-shell)
- (define-key map "\C-c\C-l" 'idlwave-shell-recenter-shell-window)
- (define-key map "\C-c\C-b" 'idlwave-list-buffer-load-path-shadows)
- (define-key map "\C-c\C-v" 'idlwave-find-module)
- (define-key map "\C-c\C-t" 'idlwave-find-module-this-file)
- (define-key map "\C-c?" 'idlwave-routine-info)
- (define-key map "\M-?" 'idlwave-context-help)
+ #'idlwave-shell-run-region)))
+ (define-key map "\C-c\C-d\C-c" #'idlwave-shell-save-and-run)
+ (define-key map "\C-c\C-d\C-b" #'idlwave-shell-break-here)
+ (define-key map "\C-c\C-d\C-e" #'idlwave-shell-run-region)
+ (define-key map "\C-c\C-f" #'idlwave-for)
+ ;; (define-key map "\C-c\C-f" #'idlwave-function)
+ ;; (define-key map "\C-c\C-p" #'idlwave-procedure)
+ (define-key map "\C-c\C-r" #'idlwave-repeat)
+ (define-key map "\C-c\C-w" #'idlwave-while)
+ (define-key map "\C-c\C-k" #'idlwave-kill-autoloaded-buffers)
+ (define-key map "\C-c\C-s" #'idlwave-shell)
+ (define-key map "\C-c\C-l" #'idlwave-shell-recenter-shell-window)
+ (define-key map "\C-c\C-b" #'idlwave-list-buffer-load-path-shadows)
+ (define-key map "\C-c\C-v" #'idlwave-find-module)
+ (define-key map "\C-c\C-t" #'idlwave-find-module-this-file)
+ (define-key map "\C-c?" #'idlwave-routine-info)
+ (define-key map "\M-?" #'idlwave-context-help)
(define-key map [(control meta ?\?)]
- 'idlwave-help-assistant-help-with-topic)
+ #'idlwave-help-assistant-help-with-topic)
;; Pickup both forms of Esc/Meta binding
- (define-key map [(meta tab)] 'idlwave-complete)
- (define-key map [?\e?\t] 'idlwave-complete)
- (define-key map "\M-\C-i" 'idlwave-complete)
- (define-key map "\C-c\C-i" 'idlwave-update-routine-info)
- (define-key map "\C-c=" 'idlwave-resolve)
- (define-key map [(shift mouse-3)] 'idlwave-mouse-context-help)
+ ;; FIXME: Use `completion-at-point'!
+ (define-key map [(meta tab)] #'idlwave-complete)
+ (define-key map [?\e?\t] #'idlwave-complete)
+ (define-key map "\M-\C-i" #'idlwave-complete)
+ (define-key map "\C-c\C-i" #'idlwave-update-routine-info)
+ (define-key map "\C-c=" #'idlwave-resolve)
+ (define-key map [(shift mouse-3)] #'idlwave-mouse-context-help)
map)
"Keymap used in IDL mode.")
st)
"Syntax table that treats symbol characters as word characters.")
-(defmacro idlwave-with-special-syntax (&rest body)
- "Execute BODY with a different syntax table."
- `(let ((saved-syntax (syntax-table)))
- (unwind-protect
- (progn
- (set-syntax-table idlwave-find-symbol-syntax-table)
- ,@body)
- (set-syntax-table saved-syntax))))
-
-;(defmacro idlwave-with-special-syntax1 (&rest body)
-; "Execute BODY with a different syntax table."
-; `(let ((saved-syntax (syntax-table)))
-; (unwind-protect
-; (progn
-; (set-syntax-table idlwave-find-symbol-syntax-table)
-; ,@body)
-; (set-syntax-table saved-syntax))))
+;;(defmacro idlwave-with-special-syntax (&rest body)
+;; "Execute BODY with `idlwave-find-symbol-syntax-table'."
+;; `(with-syntax-table idlwave-find-symbol-syntax-table
+;; ,@body))
(defun idlwave-action-and-binding (key cmd &optional select)
"KEY and CMD are made into a key binding and an indent action.
KEY is a string - same as for the `define-key' function. CMD is a
-function of no arguments or a list to be evaluated. CMD is bound to
+function of one argument. CMD is bound to
KEY in `idlwave-mode-map' by defining an anonymous function calling
`self-insert-command' followed by CMD. If KEY contains more than one
character a binding will only be set if SELECT is `both'.
Some examples:
No spaces before and 1 after a comma
- (idlwave-action-and-binding \",\" \\='(idlwave-surround 0 1))
+ (idlwave-action-and-binding \",\" (lambda (_) (idlwave-surround 0 1)))
A minimum of 1 space before and after `=' (see `idlwave-expand-equal').
- (idlwave-action-and-binding \"=\" \\='(idlwave-expand-equal -1 -1))
+ (idlwave-action-and-binding \"=\" (lambda (_) (idlwave-expand-equal -1 -1)))
Capitalize system variables - action only
- (idlwave-action-and-binding idlwave-sysvar \\='(capitalize-word 1) t)"
+ (idlwave-action-and-binding idlwave-sysvar (lambda (_) (capitalize-word 1) t))"
(if (not (equal select 'noaction))
;; Add action
(let* ((table (if select 'idlwave-indent-action-table
'idlwave-indent-expand-table))
- (table-key (regexp-quote key))
- (cell (assoc table-key (eval table))))
- (if cell
- ;; Replace action command
- (setcdr cell cmd)
- ;; New action
- (set table (append (eval table) (list (cons table-key cmd)))))))
+ (table-key (regexp-quote key)))
+ (setf (alist-get table-key (symbol-value table) nil nil #'equal) cmd)))
;; Make key binding for action
- (if (or (and (null select) (= (length key) 1))
- (equal select 'noaction)
- (equal select 'both))
+ (if (if (null select) (= (length key) 1)
+ (memq select '(noaction both)))
+ ;; FIXME: Use `post-self-insert-hook'!
(define-key idlwave-mode-map key
- `(lambda ()
- (interactive)
- (self-insert-command 1)
- ,(if (listp cmd) cmd (list cmd))))))
+ (lambda ()
+ (interactive)
+ (self-insert-command 1)
+ (if (functionp cmd) (funcall cmd nil) (eval cmd t))))))
;; Set action and key bindings.
;; See description of the function `idlwave-action-and-binding'.
;; Automatically add spaces for the following characters
;; Actions for & are complicated by &&
-(idlwave-action-and-binding "&" 'idlwave-custom-ampersand-surround)
+(idlwave-action-and-binding "&" #'idlwave-custom-ampersand-surround)
;; Automatically add spaces to equal sign if not keyword. This needs
;; to go ahead of > and <, so >= and <= will be treated correctly
-(idlwave-action-and-binding "=" '(idlwave-expand-equal -1 -1))
+(idlwave-action-and-binding "=" (lambda (_) (idlwave-expand-equal -1 -1)))
;; Actions for > and < are complicated by >=, <=, and ->...
-(idlwave-action-and-binding "<" '(idlwave-custom-ltgtr-surround nil))
-(idlwave-action-and-binding ">" '(idlwave-custom-ltgtr-surround 'gtr))
+(idlwave-action-and-binding "<" (lambda (a) (idlwave-custom-ltgtr-surround nil a)))
+(idlwave-action-and-binding ">" (lambda (a) (idlwave-custom-ltgtr-surround t a)))
-(idlwave-action-and-binding "," '(idlwave-surround 0 -1 1))
+(idlwave-action-and-binding "," (lambda (a) (idlwave-surround 0 -1 1 a)))
;;;
;;; Abbrev Section
;;;
-;;; When expanding abbrevs and the abbrev hook moves backward, an extra
-;;; space is inserted (this is the space typed by the user to expanded
-;;; the abbrev).
-;;;
-(defvar idlwave-mode-abbrev-table nil
- "Abbreviation table used for IDLWAVE mode.")
-(define-abbrev-table 'idlwave-mode-abbrev-table ())
+;; When expanding abbrevs and the abbrev hook moves backward, an extra
+;; space is inserted (this is the space typed by the user to expanded
+;; the abbrev).
+;; FIXME: This can be controlled with `no-self-insert' property.
+;;
+(define-abbrev-table 'idlwave-mode-abbrev-table ()
+ "Abbreviation table used for IDLWAVE mode."
+ :enable-function (lambda () (not (idlwave-quoted))))
(defun idlwave-define-abbrev (name expansion hook &optional noprefix table)
+ ;; FIXME: `table' is never passed.
"Define-abbrev with backward compatibility.
If NOPREFIX is non-nil, don't prepend prefix character. Installs into
expansion
hook)))
(condition-case nil
- (apply 'define-abbrev (append args '(0 t)))
- (error (apply 'define-abbrev args)))))
+ (apply #'define-abbrev (append args '(0 t)))
+ (error (apply #'define-abbrev args)))))
(condition-case nil
(modify-syntax-entry (string-to-char idlwave-abbrev-start-char)
;;
;; Templates
;;
-(idlwave-define-abbrev "c" "" (idlwave-code-abbrev idlwave-case))
-(idlwave-define-abbrev "sw" "" (idlwave-code-abbrev idlwave-switch))
-(idlwave-define-abbrev "f" "" (idlwave-code-abbrev idlwave-for))
-(idlwave-define-abbrev "fu" "" (idlwave-code-abbrev idlwave-function))
-(idlwave-define-abbrev "pr" "" (idlwave-code-abbrev idlwave-procedure))
-(idlwave-define-abbrev "r" "" (idlwave-code-abbrev idlwave-repeat))
-(idlwave-define-abbrev "w" "" (idlwave-code-abbrev idlwave-while))
-(idlwave-define-abbrev "i" "" (idlwave-code-abbrev idlwave-if))
-(idlwave-define-abbrev "elif" "" (idlwave-code-abbrev idlwave-elif))
+(idlwave-define-abbrev "c" "" #'idlwave-case)
+(idlwave-define-abbrev "sw" "" #'idlwave-switch)
+(idlwave-define-abbrev "f" "" #'idlwave-for)
+(idlwave-define-abbrev "fu" "" #'idlwave-function)
+(idlwave-define-abbrev "pr" "" #'idlwave-procedure)
+(idlwave-define-abbrev "r" "" #'idlwave-repeat)
+(idlwave-define-abbrev "w" "" #'idlwave-while)
+(idlwave-define-abbrev "i" "" #'idlwave-if)
+(idlwave-define-abbrev "elif" "" #'idlwave-elif)
;;
;; Keywords, system functions, conversion routines
;;
(idlwave-define-abbrev "cc" "complex()" (idlwave-keyword-abbrev 1))
(idlwave-define-abbrev "cd" "double()" (idlwave-keyword-abbrev 1))
(idlwave-define-abbrev "e" "else" (idlwave-keyword-abbrev 0 t))
-(idlwave-define-abbrev "ec" "endcase" 'idlwave-show-begin)
-(idlwave-define-abbrev "es" "endswitch" 'idlwave-show-begin)
-(idlwave-define-abbrev "ee" "endelse" 'idlwave-show-begin)
-(idlwave-define-abbrev "ef" "endfor" 'idlwave-show-begin)
-(idlwave-define-abbrev "ei" "endif else if" 'idlwave-show-begin)
-(idlwave-define-abbrev "el" "endif else" 'idlwave-show-begin)
-(idlwave-define-abbrev "en" "endif" 'idlwave-show-begin)
-(idlwave-define-abbrev "er" "endrep" 'idlwave-show-begin)
-(idlwave-define-abbrev "ew" "endwhile" 'idlwave-show-begin)
+(idlwave-define-abbrev "ec" "endcase" #'idlwave-show-begin)
+(idlwave-define-abbrev "es" "endswitch" #'idlwave-show-begin)
+(idlwave-define-abbrev "ee" "endelse" #'idlwave-show-begin)
+(idlwave-define-abbrev "ef" "endfor" #'idlwave-show-begin)
+(idlwave-define-abbrev "ei" "endif else if" #'idlwave-show-begin)
+(idlwave-define-abbrev "el" "endif else" #'idlwave-show-begin)
+(idlwave-define-abbrev "en" "endif" #'idlwave-show-begin)
+(idlwave-define-abbrev "er" "endrep" #'idlwave-show-begin)
+(idlwave-define-abbrev "ew" "endwhile" #'idlwave-show-begin)
(idlwave-define-abbrev "g" "goto," (idlwave-keyword-abbrev 0 t))
(idlwave-define-abbrev "h" "help," (idlwave-keyword-abbrev 0))
(idlwave-define-abbrev "k" "keyword_set()" (idlwave-keyword-abbrev 1))
(idlwave-define-abbrev "continue" "continue" (idlwave-keyword-abbrev 0 t) t)
(idlwave-define-abbrev "do" "do" (idlwave-keyword-abbrev 0 t) t)
(idlwave-define-abbrev "else" "else" (idlwave-keyword-abbrev 0 t) t)
-(idlwave-define-abbrev "end" "end" 'idlwave-show-begin-check t)
-(idlwave-define-abbrev "endcase" "endcase" 'idlwave-show-begin-check t)
-(idlwave-define-abbrev "endelse" "endelse" 'idlwave-show-begin-check t)
-(idlwave-define-abbrev "endfor" "endfor" 'idlwave-show-begin-check t)
-(idlwave-define-abbrev "endif" "endif" 'idlwave-show-begin-check t)
-(idlwave-define-abbrev "endrep" "endrep" 'idlwave-show-begin-check t)
-(idlwave-define-abbrev "endswitch" "endswitch" 'idlwave-show-begin-check t)
-(idlwave-define-abbrev "endwhi" "endwhi" 'idlwave-show-begin-check t)
-(idlwave-define-abbrev "endwhile" "endwhile" 'idlwave-show-begin-check t)
+(idlwave-define-abbrev "end" "end" #'idlwave-show-begin-check t)
+(idlwave-define-abbrev "endcase" "endcase" #'idlwave-show-begin-check t)
+(idlwave-define-abbrev "endelse" "endelse" #'idlwave-show-begin-check t)
+(idlwave-define-abbrev "endfor" "endfor" #'idlwave-show-begin-check t)
+(idlwave-define-abbrev "endif" "endif" #'idlwave-show-begin-check t)
+(idlwave-define-abbrev "endrep" "endrep" #'idlwave-show-begin-check t)
+(idlwave-define-abbrev "endswitch" "endswitch" #'idlwave-show-begin-check t)
+(idlwave-define-abbrev "endwhi" "endwhi" #'idlwave-show-begin-check t)
+(idlwave-define-abbrev "endwhile" "endwhile" #'idlwave-show-begin-check t)
(idlwave-define-abbrev "eq" "eq" (idlwave-keyword-abbrev 0 t) t)
(idlwave-define-abbrev "for" "for" (idlwave-keyword-abbrev 0 t) t)
(idlwave-define-abbrev "function" "function" (idlwave-keyword-abbrev 0 t) t)
Use \\[idlwave-fill-paragraph] to refill a paragraph inside a
comment. The indentation of the second line of the paragraph
relative to the first will be retained. Use
- \\[idlwave-auto-fill-mode] to toggle auto-fill mode for these
+ \\[auto-fill-mode] to toggle auto-fill mode for these
comments. When the variable `idlwave-fill-comment-line-only' is
nil, code can also be auto-filled and auto-indented.
(message "Emacs IDLWAVE mode version %s." idlwave-mode-version))
(setq idlwave-startup-message nil)
- (set (make-local-variable 'indent-line-function) 'idlwave-indent-and-action)
+ (set (make-local-variable 'indent-line-function) #'idlwave-indent-and-action)
(set (make-local-variable idlwave-comment-indent-function)
#'idlwave-comment-hook)
(setq abbrev-mode t)
- (set (make-local-variable idlwave-fill-function) 'idlwave-auto-fill)
+ (set (make-local-variable 'normal-auto-fill-function) #'idlwave-auto-fill)
(setq comment-end "")
(set (make-local-variable 'comment-multi-line) nil)
(set (make-local-variable 'paragraph-separate)
;; ChangeLog
(set (make-local-variable 'add-log-current-defun-function)
- 'idlwave-current-routine-fullname)
+ #'idlwave-current-routine-fullname)
;; Set tag table list to use IDLTAGS as file name.
(if (boundp 'tag-table-alist)
- (add-to-list 'tag-table-alist '("\\.pro$" . "IDLTAGS")))
+ (add-to-list 'tag-table-alist '("\\.pro\\'" . "IDLTAGS")))
;; Font-lock additions
(set (make-local-variable 'font-lock-defaults) idlwave-font-lock-defaults)
(set (make-local-variable 'font-lock-mark-block-function)
- 'idlwave-mark-subprogram)
+ #'idlwave-mark-subprogram)
(set (make-local-variable 'font-lock-fontify-region-function)
- 'idlwave-font-lock-fontify-region)
+ #'idlwave-font-lock-fontify-region)
;; Imenu setup
- (set (make-local-variable 'imenu-create-index-function)
- 'imenu-default-create-index-function)
+ ;;(set (make-local-variable 'imenu-create-index-function)
+ ;; ;; FIXME: Why set it explicitly to the value it already has?
+ ;; #'imenu-default-create-index-function)
(set (make-local-variable 'imenu-extract-index-name-function)
- 'idlwave-unit-name)
+ #'idlwave-unit-name)
(set (make-local-variable 'imenu-prev-index-position-function)
- 'idlwave-prev-index-position)
+ #'idlwave-prev-index-position)
;; HideShow setup
(add-to-list 'hs-special-modes-alist
'idlwave-forward-block nil))
;; Make a local post-command-hook and add our hook to it
- (add-hook 'post-command-hook 'idlwave-command-hook nil 'local)
+ (add-hook 'post-command-hook #'idlwave-command-hook nil 'local)
;; Make local hooks for buffer updates
- (add-hook 'kill-buffer-hook 'idlwave-kill-buffer-update nil 'local)
- (add-hook 'after-save-hook 'idlwave-save-buffer-update nil 'local)
- (add-hook 'after-save-hook 'idlwave-revoke-license-to-kill nil 'local)
+ (add-hook 'kill-buffer-hook #'idlwave-kill-buffer-update nil 'local)
+ (add-hook 'after-save-hook #'idlwave-save-buffer-update nil 'local)
+ (add-hook 'after-save-hook #'idlwave-revoke-license-to-kill nil 'local)
;; Setup directories and file, if necessary
(idlwave-setup)
;;; This stuff is experimental
-(defvar idlwave-command-hook nil
- "If non-nil, a list that can be evaluated using `eval'.
+(defvar idlwave--command-function nil
+ "If non-nil, a function called from `post-command-hook'.
It is evaluated in the lisp function `idlwave-command-hook' which is
placed in `post-command-hook'.")
(defun idlwave-command-hook ()
"Command run after every command.
-Evaluates a non-nil value of the *variable* `idlwave-command-hook' and
+Evaluates a non-nil value of the *variable* `idlwave--command-function' and
sets the variable to zero afterwards."
- (and idlwave-command-hook
- (listp idlwave-command-hook)
- (condition-case nil
- (eval idlwave-command-hook)
- (error nil)))
- (setq idlwave-command-hook nil))
+ (and idlwave--command-function
+ (with-demoted-errors "idlwave-command-hook: %S"
+ (funcall (prog1 idlwave--command-function
+ (setq idlwave--command-function nil))))))
;;; End experiment
;; It would be better to use expand.el for better abbrev handling and
;; versatility.
-(defun idlwave-check-abbrev (arg &optional reserved)
- "Reverse abbrev expansion if in comment or string.
+(defun idlwave-modify-abbrev (arg &optional reserved)
+ "Tweak the abbrev we just expanded.
Argument ARG is the number of characters to move point
backward if `idlwave-abbrev-move' is non-nil.
If optional argument RESERVED is non-nil then the expansion
is non-nil, unless its value is `down' in which case the abbrev will be
made into all lowercase.
Returns non-nil if abbrev is left expanded."
- (if (idlwave-quoted)
- (progn (unexpand-abbrev)
- nil)
- (if (and reserved idlwave-reserved-word-upcase)
- (upcase-region last-abbrev-location (point))
- (cond
- ((equal idlwave-abbrev-change-case 'down)
- (downcase-region last-abbrev-location (point)))
- (idlwave-abbrev-change-case
- (upcase-region last-abbrev-location (point)))))
- (if (and idlwave-abbrev-move (> arg 0))
- (if (boundp 'post-command-hook)
- (setq idlwave-command-hook (list 'backward-char (1+ arg)))
- (backward-char arg)))
- t))
+ (if (and reserved idlwave-reserved-word-upcase)
+ (upcase-region last-abbrev-location (point))
+ (cond
+ ((equal idlwave-abbrev-change-case 'down)
+ (downcase-region last-abbrev-location (point)))
+ (idlwave-abbrev-change-case
+ (upcase-region last-abbrev-location (point)))))
+ (if (and idlwave-abbrev-move (> arg 0))
+ (setq idlwave--command-function (lambda () (backward-char (1+ arg)))))
+ t)
(defun idlwave-in-comment ()
"Return t if point is inside a comment, nil otherwise."
(backward-char 1)
(point)))))
-(define-obsolete-function-alias 'idlwave-region-active-p 'use-region-p "28.1")
+(define-obsolete-function-alias 'idlwave-region-active-p #'use-region-p "28.1")
(defun idlwave-show-matching-quote ()
"Insert quote and show matching quote if this is end of a string."
(defun idlwave-show-begin-check ()
"Ensure that the previous word was a token before `idlwave-show-begin'.
An END token must be preceded by whitespace."
- (if (not (idlwave-quoted))
- (if
- (save-excursion
- (backward-word-strictly 1)
- (backward-char 1)
- (looking-at "[ \t\n\f]"))
- (idlwave-show-begin))))
+ (if
+ (save-excursion
+ (backward-word-strictly 1)
+ (backward-char 1)
+ (looking-at "[ \t\n\f]"))
+ (idlwave-show-begin)))
(defun idlwave-show-begin ()
"Find the start of current block and blinks to it for a second.
begin-pos end-pos end end1 )
(if idlwave-reindent-end (idlwave-indent-line))
(setq last-abbrev-location (marker-position last-abbrev-marker))
- (when (and (idlwave-check-abbrev 0 t)
+ (when (and (idlwave-modify-abbrev 0 t)
idlwave-show-block)
(save-excursion
;; Move inside current block
(next-char (char-after (point)))
(method-invoke (and gtr (eq prev-char ?-)))
(len (if method-invoke 2 1)))
- (unless (eq next-char ?=)
+ (unless (eq next-char ?=)
;; Key binding: pad only on left, to save for possible >=/<=
(idlwave-surround -1 (if (or is-action method-invoke) -1) len))))
-(defun idlwave-surround (&optional before after length is-action)
+(defun idlwave-surround (&optional before after length _is-action)
"Surround the LENGTH characters before point with blanks.
LENGTH defaults to 1.
Optional arguments BEFORE and AFTER affect the behavior before and
(if st
(append st (match-end 0))))))
-(defun idlwave-expand-equal (&optional before after is-action)
+(defun idlwave-expand-equal (&optional before after _is-action)
"Pad `=' with spaces.
Two cases: Assignment statement, and keyword assignment.
Which case is determined using `idlwave-start-of-substatement' and
;; Before indenting, run action routines.
;;
(if (and expand idlwave-do-actions)
- (mapc 'idlwave-do-action idlwave-indent-expand-table))
+ (mapc #'idlwave-do-action idlwave-indent-expand-table))
;;
(if idlwave-do-actions
- (mapc 'idlwave-do-action idlwave-indent-action-table))
+ (mapc #'idlwave-do-action idlwave-indent-action-table))
;;
;; No longer expand abbrevs on the line. The user can do this
;; manually using expand-region-abbrevs.
(defun idlwave-do-action (action)
"Perform an action repeatedly on a line.
ACTION is a list (REG . FUNC). REG is a regular expression. FUNC is
-either a function name to be called with `funcall' or a list to be
-evaluated with `eval'. The action performed by FUNC should leave
-point after the match for REG - otherwise an infinite loop may be
-entered. FUNC is always passed a final argument of `is-action', so it
+either a function which will be called with one argument `is-action' or
+a list to be evaluated with `eval'.
+The action performed by FUNC should leave point after the match for REG
+- otherwise an infinite loop may be entered.
+FUNC is always passed a final argument of `is-action', so it
can discriminate between being run as an action, or a key binding."
(let ((action-key (car action))
(action-routine (cdr action)))
(beginning-of-line)
(while (idlwave-look-at action-key)
- (if (listp action-routine)
- (eval (append action-routine '('is-action)))
- (funcall action-routine 'is-action)))))
+ (if (functionp action-routine)
+ (funcall action-routine 'is-action)
+ (eval (append action-routine '('is-action)) t)))))
(defun idlwave-indent-to (col &optional min)
"Indent from point with spaces until column COL.
(let ((case-fold-search t)
(search-func (if (> dir 0) 're-search-forward 're-search-backward))
found)
- (idlwave-with-special-syntax
+ (with-syntax-table idlwave-find-symbol-syntax-table
(save-excursion
(catch 'exit
(while (funcall search-func key-re limit t)
(if cont (idlwave-end-of-statement) (end-of-line))
(point)))
found)
- (idlwave-with-special-syntax
+ (with-syntax-table idlwave-find-symbol-syntax-table
(if beg (idlwave-beginning-of-statement))
(while (and (setq found (re-search-forward regexp eos t))
(idlwave-quoted))))
(idlwave-indent-line))
)))))
-(defun idlwave-auto-fill-mode (arg)
- "Toggle auto-fill mode for IDL mode.
-With arg, turn auto-fill mode on if arg is positive.
-In auto-fill mode, inserting a space at a column beyond `fill-column'
-automatically breaks the line at a previous space."
- (interactive "P")
- (prog1 (set idlwave-fill-function
- (if (if (null arg)
- (not (symbol-value idlwave-fill-function))
- (> (prefix-numeric-value arg) 0))
- 'idlwave-auto-fill
- nil))
- ;; update mode-line
- (set-buffer-modified-p (buffer-modified-p))))
-
-;(defun idlwave-fill-routine-call ()
-; "Fill a routine definition or statement, indenting appropriately."
-; (let ((where (idlwave-where)))))
-
+(define-obsolete-function-alias 'idlwave-auto-fill-mode #'auto-fill-mode "28.1")
(defun idlwave-doc-header (&optional nomark)
"Insert a documentation header at the beginning of the unit.
(defun idlwave-quoted ()
"Return t if point is in a comment or quoted string.
Returns nil otherwise."
+ ;; FIXME: Use (nth 8 (synx-ppss))!
(and (or (idlwave-in-comment) (idlwave-in-quote)) t))
(defun idlwave-in-quote ()
(setq idlwave-outlawed-buffers
(delq entry idlwave-outlawed-buffers)))
;; Remove this function from the hook.
- (remove-hook 'after-save-hook 'idlwave-revoke-license-to-kill 'local)))
+ (remove-hook 'after-save-hook #'idlwave-revoke-license-to-kill 'local)))
(defvar idlwave-path-alist)
(defun idlwave-locate-lib-file (file)
(set (idlwave-sintern-set name 'class idlwave-sint-classes set))
(name)))
-(defun idlwave-sintern-dir (dir &optional set)
+(defun idlwave-sintern-dir (dir &optional _set)
(car (or (member dir idlwave-sint-dirs)
(setq idlwave-sint-dirs (cons dir idlwave-sint-dirs)))))
-(defun idlwave-sintern-libname (name &optional set)
+(defun idlwave-sintern-libname (name &optional _set)
(car (or (member name idlwave-sint-libnames)
(setq idlwave-sint-libnames (cons name idlwave-sint-libnames)))))
;; Creating new sintern tables
-(defun idlwave-new-sintern-type (tag)
+(defmacro idlwave-new-sintern-type (tag)
"Define a variable and a function to sintern the new type TAG.
This defines the function `idlwave-sintern-TAG' and the variable
`idlwave-sint-TAGs'."
(names (concat name "s"))
(var (intern (concat "idlwave-sint-" names)))
(func (intern (concat "idlwave-sintern-" name))))
- (set var nil) ; initial value of the association list
- (fset func ; set the function
- `(lambda (name &optional set)
- (cond ((not (stringp name)) name)
- ((cdr (assoc (downcase name) ,var)))
- (set
- (setq ,var (cons (cons (downcase name) name) ,var))
- name)
- (name))))))
+ `(progn
+ (defvar ,var nil) ; initial value of the association list
+ (defun ,func (name &optional set)
+ (cond ((not (stringp name)) name)
+ ((cdr (assoc (downcase name) ,var)))
+ (set
+ (push (cons (downcase name) name) ,var)
+ name)
+ (name))))))
(defun idlwave-reset-sintern-type (tag)
"Reset the sintern variable associated with TAG."
"-l" (expand-file-name "~/.emacs")
"-l" "idlwave"
"-f" "idlwave-rescan-catalog-directories"))
- (process (apply 'start-process "idlcat"
+ (process (apply #'start-process "idlcat"
nil emacs args)))
(setq idlwave-catalog-process process)
(set-process-sentinel
process
- (lambda (pro why)
+ (lambda (_pro why)
(when (string-match "finished" why)
(setq idlwave-routines nil
idlwave-system-routines nil
(setq idlwave-load-rinfo-idle-timer
(run-with-idle-timer
idlwave-init-rinfo-when-idle-after
- nil 'idlwave-load-rinfo-next-step)))
+ nil #'idlwave-load-rinfo-next-step)))
(error nil))))
;;------ XML Help routine info system
(setq idlwave-load-rinfo-idle-timer
(run-with-idle-timer
idlwave-init-rinfo-when-idle-after
- nil 'idlwave-load-rinfo-next-step))))))
+ nil #'idlwave-load-rinfo-next-step))))))
(defvar idlwave-after-load-rinfo-hook nil)
(error nil)))
(push res routine-lists)))))
;; Concatenate the individual lists and return the result
- (apply 'nconc routine-lists)))
+ (apply #'nconc routine-lists)))
(defun idlwave-get-buffer-routine-info ()
"Scan the current buffer for routine info. Return (PRO-LIST FUNC-LIST)."
(if args
(concat
(if (string= type "function") "(" ", ")
- (mapconcat 'identity args ", ")
+ (mapconcat #'identity args ", ")
(if (string= type "function") ")" ""))))
(if keywords
- (cons nil (mapcar 'list keywords)) ;No help file
+ (cons nil (mapcar #'list keywords)) ;No help file
nil))))
(cons x (cdr path-entry))
(list x))))
(idlwave-expand-path idlwave-library-path))
- (mapcar 'list (idlwave-expand-path idlwave-library-path)))))
+ (mapcar #'list (idlwave-expand-path idlwave-library-path)))))
;; Ask the shell for the path and then run the widget
(t
(widget-insert " ")
(widget-create 'push-button
:notify
- (lambda (&rest ignore)
+ (lambda (&rest _ignore)
(let ((path-list (widget-get idlwave-widget :path-dirs)))
(dolist (x path-list)
(unless (memq 'lib (cdr x))
(widget-insert " ")
(widget-create 'push-button
:notify
- (lambda (&rest ignore)
+ (lambda (&rest _ignore)
(let ((path-list (widget-get idlwave-widget :path-dirs)))
(dolist (x path-list)
(idlwave-path-alist-remove-flag x 'user))
"Deselect All")
(widget-insert " ")
(widget-create 'push-button
- :notify (lambda (&rest ignore)
+ :notify (lambda (&rest _ignore)
(kill-buffer (current-buffer)))
"Quit")
(widget-insert "\n\n")
(widget-insert "Select Directories: \n")
(setq idlwave-widget
- (apply 'widget-create
+ (apply #'widget-create
'checklist
:value (delq nil (mapcar (lambda (x)
(if (memq 'user (cdr x))
(list 'item
(if (memq 'lib (cdr x))
(concat "[LIB] " (car x) )
- (car x)))) dirs-list)))
+ (car x))))
+ dirs-list)))
(widget-put idlwave-widget :path-dirs dirs-list)
(widget-insert "\n")
(use-local-map widget-keymap)
(goto-char (point-min))
(delete-other-windows))
-(defun idlwave-delete-user-catalog-file (&rest ignore)
+(defun idlwave-delete-user-catalog-file (&rest _ignore)
(if (yes-or-no-p
(format "Delete file %s " idlwave-user-catalog-file))
(progn
(delete-file idlwave-user-catalog-file)
(message "%s has been deleted" idlwave-user-catalog-file))))
-(defun idlwave-widget-scan-user-lib-files (&rest ignore)
+(defun idlwave-widget-scan-user-lib-files (&rest _ignore)
;; Call `idlwave-scan-user-lib-files' with data taken from the widget.
(let* ((widget idlwave-widget)
(selected-dirs (widget-value widget))
(let ((dirs
(if idlwave-library-path
(idlwave-expand-path idlwave-library-path)
- (mapcar 'car idlwave-path-alist)))
+ (mapcar #'car idlwave-path-alist)))
(old-libname "")
dir-entry dir catalog all-routines)
(if message-base (message "%s" message-base))
(defvar idlwave-completion-help-info nil)
(defvar idlwave-completion-help-links nil)
(defvar idlwave-current-obj_new-class nil)
-(defvar idlwave-complete-special nil)
-(defvar method-selector)
-(defvar class-selector)
-(defvar type-selector)
-(defvar super-classes)
+(defvar idlwave--method-selector)
+(defvar idlwave--class-selector)
+(defvar idlwave--type-selector)
+(defvar idlwave--super-classes)
(defun idlwave-complete (&optional arg module class)
"Complete a function, procedure or keyword name at point.
(idlwave-complete-filename))
;; Check for any special completion functions
- ((and idlwave-complete-special
- (idlwave-call-special idlwave-complete-special)))
+ ((run-hook-with-args-until-success 'idlwave-complete-functions))
((null what)
(error "Nothing to complete here"))
((eq what 'procedure)
;; Complete a procedure name
(let* ((cw-list (nth 3 where-list))
- (class-selector (idlwave-determine-class cw-list 'pro))
- (super-classes (unless (idlwave-explicit-class-listed cw-list)
- (idlwave-all-class-inherits class-selector)))
- (isa (concat "procedure" (if class-selector "-method" "")))
- (type-selector 'pro))
+ (idlwave--class-selector (idlwave-determine-class cw-list 'pro))
+ (idlwave--super-classes
+ (unless (idlwave-explicit-class-listed cw-list)
+ (idlwave-all-class-inherits idlwave--class-selector)))
+ (isa (concat "procedure"
+ (if idlwave--class-selector "-method" "")))
+ (idlwave--type-selector 'pro))
(setq idlwave-completion-help-info
- (list 'routine nil type-selector class-selector nil super-classes))
+ (list 'routine nil
+ idlwave--type-selector idlwave--class-selector
+ nil idlwave--super-classes))
(idlwave-complete-in-buffer
- 'procedure (if class-selector 'method 'routine)
+ 'procedure (if idlwave--class-selector 'method 'routine)
(idlwave-routines) 'idlwave-selector
(format "Select a %s name%s"
isa
- (if class-selector
+ (if idlwave--class-selector
(format " (class is %s)"
- (if (eq class-selector t)
- "unknown" class-selector))
+ (if (eq idlwave--class-selector t)
+ "unknown" idlwave--class-selector))
""))
isa
'idlwave-attach-method-classes 'idlwave-add-file-link-selector)))
((eq what 'function)
;; Complete a function name
(let* ((cw-list (nth 3 where-list))
- (class-selector (idlwave-determine-class cw-list 'fun))
- (super-classes (unless (idlwave-explicit-class-listed cw-list)
- (idlwave-all-class-inherits class-selector)))
- (isa (concat "function" (if class-selector "-method" "")))
- (type-selector 'fun))
+ (idlwave--class-selector (idlwave-determine-class cw-list 'fun))
+ (idlwave--super-classes
+ (unless (idlwave-explicit-class-listed cw-list)
+ (idlwave-all-class-inherits idlwave--class-selector)))
+ (isa (concat "function" (if idlwave--class-selector "-method" "")))
+ (idlwave--type-selector 'fun))
(setq idlwave-completion-help-info
- (list 'routine nil type-selector class-selector nil super-classes))
+ (list 'routine nil
+ idlwave--type-selector idlwave--class-selector
+ nil idlwave--super-classes))
(idlwave-complete-in-buffer
- 'function (if class-selector 'method 'routine)
+ 'function (if idlwave--class-selector 'method 'routine)
(idlwave-routines) 'idlwave-selector
(format "Select a %s name%s"
isa
- (if class-selector
+ (if idlwave--class-selector
(format " (class is %s)"
- (if (eq class-selector t)
- "unknown" class-selector))
+ (if (eq idlwave--class-selector t)
+ "unknown" idlwave--class-selector))
""))
isa
'idlwave-attach-method-classes 'idlwave-add-file-link-selector)))
;; Complete a procedure keyword
(let* ((where (nth 3 where-list))
(name (car where))
- (method-selector name)
- (type-selector 'pro)
+ (idlwave--method-selector name)
+ (idlwave--type-selector 'pro)
(class (idlwave-determine-class where 'pro))
- (class-selector class)
- (super-classes (idlwave-all-class-inherits class-selector))
+ (idlwave--class-selector class)
+ (idlwave--super-classes (idlwave-all-class-inherits
+ idlwave--class-selector))
(isa (format "procedure%s-keyword" (if class "-method" "")))
(entry (idlwave-best-rinfo-assq
name 'pro class (idlwave-routines)))
(error "Nothing known about procedure %s"
(idlwave-make-full-name class name)))
(setq list (idlwave-fix-keywords name 'pro class list
- super-classes system))
+ idlwave--super-classes system))
(unless list (error "No keywords available for procedure %s"
(idlwave-make-full-name class name)))
(setq idlwave-completion-help-info
- (list 'keyword name type-selector class-selector entry super-classes))
+ (list 'keyword name
+ idlwave--type-selector idlwave--class-selector
+ entry idlwave--super-classes))
(idlwave-complete-in-buffer
'keyword 'keyword list nil
(format "Select keyword for procedure %s%s"
;; Complete a function keyword
(let* ((where (nth 3 where-list))
(name (car where))
- (method-selector name)
- (type-selector 'fun)
+ (idlwave--method-selector name)
+ (idlwave--type-selector 'fun)
(class (idlwave-determine-class where 'fun))
- (class-selector class)
- (super-classes (idlwave-all-class-inherits class-selector))
+ (idlwave--class-selector class)
+ (idlwave--super-classes (idlwave-all-class-inherits
+ idlwave--class-selector))
(isa (format "function%s-keyword" (if class "-method" "")))
(entry (idlwave-best-rinfo-assq
name 'fun class (idlwave-routines)))
(error "Nothing known about function %s"
(idlwave-make-full-name class name)))
(setq list (idlwave-fix-keywords name 'fun class list
- super-classes system))
+ idlwave--super-classes system))
;; OBJ_NEW: Messages mention the proper Init method
(setq msg-name (if (and (null class)
(string= (upcase name) "OBJ_NEW"))
(unless list (error "No keywords available for function %s"
msg-name))
(setq idlwave-completion-help-info
- (list 'keyword name type-selector class-selector nil super-classes))
+ (list 'keyword name
+ idlwave--type-selector idlwave--class-selector
+ nil idlwave--super-classes))
(idlwave-complete-in-buffer
'keyword 'keyword list nil
(format "Select keyword for function %s%s" msg-name
(t (error "This should not happen (idlwave-complete)")))))
-(defvar idlwave-complete-special nil
+(define-obsolete-variable-alias 'idlwave-complete-special
+ 'idlwave-complete-functions "28.1")
+(defvar idlwave-complete-functions nil
"List of special completion functions.
These functions are called for each completion. Each function must
check if its own special completion context is present. If yes, it
other completions will be tried.")
(defun idlwave-call-special (functions &rest args)
+ (declare (obsolete run-hook-with-args-until-success "28.1"))
(let ((funcs functions)
fun ret)
(catch 'exit
(list nil-list nil-list 'procedure nil-list nil))
((eq what 'procedure-keyword)
- (let* ((class-selector nil)
- (super-classes nil)
- (type-selector 'pro)
+ (let* ((idlwave--class-selector nil)
+ (idlwave--super-classes nil)
+ (idlwave--type-selector 'pro)
(pro (or module
(idlwave-completing-read
"Procedure: " (idlwave-routines) 'idlwave-selector))))
(list nil-list nil-list 'function nil-list nil))
((eq what 'function-keyword)
- (let* ((class-selector nil)
- (super-classes nil)
- (type-selector 'fun)
+ (let* ((idlwave--class-selector nil)
+ (idlwave--super-classes nil)
+ (idlwave--type-selector 'fun)
(func (or module
(idlwave-completing-read
"Function: " (idlwave-routines) 'idlwave-selector))))
((eq what 'procedure-method-keyword)
(let* ((class (idlwave-determine-class class-list 'pro))
- (class-selector class)
- (super-classes (idlwave-all-class-inherits class-selector))
- (type-selector 'pro)
+ (idlwave--class-selector class)
+ (idlwave--super-classes (idlwave-all-class-inherits
+ idlwave--class-selector))
+ (idlwave--type-selector 'pro)
(pro (or module
(idlwave-completing-read
- (format "Procedure in %s class: " class-selector)
+ (format "Procedure in %s class: "
+ idlwave--class-selector)
(idlwave-routines) 'idlwave-selector))))
(setq pro (idlwave-sintern-method pro))
(list nil-list nil-list 'procedure-keyword
((eq what 'function-method-keyword)
(let* ((class (idlwave-determine-class class-list 'fun))
- (class-selector class)
- (super-classes (idlwave-all-class-inherits class-selector))
- (type-selector 'fun)
+ (idlwave--class-selector class)
+ (idlwave--super-classes (idlwave-all-class-inherits
+ idlwave--class-selector))
+ (idlwave--type-selector 'fun)
(func (or module
(idlwave-completing-read
- (format "Function in %s class: " class-selector)
+ (format "Function in %s class: "
+ idlwave--class-selector)
(idlwave-routines) 'idlwave-selector))))
(setq func (idlwave-sintern-method func))
(list nil-list nil-list 'function-keyword
(unwind-protect
(progn
(setq-default completion-ignore-case t)
- (apply 'completing-read args))
+ (apply #'completing-read args))
(setq-default completion-ignore-case old-value))))
(defvar idlwave-shell-default-directory)
(defun idlwave-complete-filename ()
"Use the comint stuff to complete a file name."
(require 'comint)
- (let* ((comint-file-name-chars "~/A-Za-z0-9+@:_.$#%={}\\-")
+ (dlet ((comint-file-name-chars "~/A-Za-z0-9+@:_.$#%={}\\-")
(comint-completion-addsuffix nil)
(default-directory
(if (and (boundp 'idlwave-shell-default-directory)
(defun idlwave-rinfo-assq-any-class (name type class list)
;; Return the first matching method on the inheritance list
(let* ((classes (cons class (idlwave-all-class-inherits class)))
- class rtn)
+ rtn) ;; class
(while classes
(if (setq rtn (idlwave-rinfo-assq name type (pop classes) list))
(setq classes nil)))
list))
syslibp)
(when (> (length twins) 1)
- (setq twins (sort twins 'idlwave-routine-entry-compare-twins))
+ (setq twins (sort twins #'idlwave-routine-entry-compare-twins))
(if (and (null keep-system)
(eq 'system (car (nth 3 (car twins))))
(setq syslibp (idlwave-any-syslib (cdr twins)))
TYPE is `fun' or `pro'.
When TYPE is not specified, both procedures and functions will be considered."
(if (null method)
- (mapcar 'car (idlwave-class-alist))
+ (mapcar #'car (idlwave-class-alist))
(let (rtn)
(mapc (lambda (x)
(and (nth 2 x)
(save-excursion (goto-char apos)
(looking-at "->[a-zA-Z][a-zA-Z0-9$_]*::")))))
-(defvar idlwave-determine-class-special nil
- "List of special functions for determining class.
-Must accept two arguments: `apos' and `info'.")
+(define-obsolete-variable-alias 'idlwave-determine-class-special
+ 'idlwave-determine-class-functions "28.1")
+(defvar idlwave-determine-class-functions nil
+ "Special hook to determine a class.
+The functions should accept one argument, APOS.")
(defun idlwave-determine-class (info type)
;; Determine the class of a routine call.
;; Before prompting, try any special class determination routines
(when (and (eq t class)
- idlwave-determine-class-special
(not force-query))
(setq special-class
- (idlwave-call-special idlwave-determine-class-special apos))
+ (run-hook-with-args-until-success
+ 'idlwave-determine-class-functions apos))
(if special-class
(setq class (idlwave-sintern-class special-class)
store idlwave-store-inquired-class)))
(when (and (eq class t)
(or force-query query))
(setq class-alist
- (mapcar 'list (idlwave-all-method-classes (car info) type)))
+ (mapcar #'list (idlwave-all-method-classes (car info) type)))
(setq class
(idlwave-sintern-class
(cond
(t class))))
(defun idlwave-selector (a)
- (and (eq (nth 1 a) type-selector)
- (or (and (nth 2 a) (eq class-selector t))
- (eq (nth 2 a) class-selector)
- (memq (nth 2 a) super-classes))))
+ (and (eq (nth 1 a) idlwave--type-selector)
+ (or (and (nth 2 a) (eq idlwave--class-selector t))
+ (eq (nth 2 a) idlwave--class-selector)
+ (memq (nth 2 a) idlwave--super-classes))))
(defun idlwave-add-file-link-selector (a)
;; Record a file link, if any, for the tested names during selection.
func-point
(cnt 0)
func arrow-start class)
- (idlwave-with-special-syntax
+ (with-syntax-table idlwave-find-symbol-syntax-table
(save-restriction
(save-excursion
(narrow-to-region (max 1 (or bound 0)) (point-max))
(goto-char pos))
(throw 'exit nil)))))))
-(defun idlwave-what-procedure (&optional bound)
+(defun idlwave-what-procedure (&optional _bound)
;; Find out if point is within the argument list of a procedure.
;; The return value is ("procedure-name" class arrow-pos (point)).
(throw 'exit nil)))
(t (throw 'exit (preceding-char))))))))
-(defvar idlwave-complete-after-success-form nil
- "A form to evaluate after successful completion.")
-(defvar idlwave-complete-after-success-form-force nil
- "A form to evaluate after completion selection in *Completions* buffer.")
+(defvar idlwave--complete-after-success-function #'ignore
+ "A function to evaluate after successful completion.")
+(defvar idlwave--complete-after-success-force-function #'ignore
+ "A function to evaluate after completion selection in *Completions* buffer.")
(defconst idlwave-completion-mark (make-marker)
"A mark pointing to the beginning of the completion string.")
(skip-chars-backward "a-zA-Z0-9_$")
(setq slash (eq (preceding-char) ?/)
beg (point)
- idlwave-complete-after-success-form
- (list 'idlwave-after-successful-completion
- (list 'quote type) slash beg)
- idlwave-complete-after-success-form-force
- (list 'idlwave-after-successful-completion
- (list 'quote type) slash (list 'quote 'force))))
+ idlwave--complete-after-success-function
+ (lambda () (idlwave-after-successful-completion
+ type slash beg))
+ idlwave--complete-after-success-force-function
+ (lambda () (idlwave-after-successful-completion
+ type slash 'force))))
;; Try a completion
(setq part (buffer-substring beg end)
;; 'class-tag, for class tags, and otherwise for methods.
;; SHOW-CLASSES is the value of `idlwave-completion-show-classes'.
(if (or (null show-classes) ; don't want to see classes
- (null class-selector) ; not a method call
+ (null idlwave--class-selector) ; not a method call
(and
- (stringp class-selector) ; the class is already known
- (not super-classes))) ; no possibilities for inheritance
+ (stringp idlwave--class-selector) ; the class is already known
+ (not idlwave--super-classes))) ; no possibilities for inheritance
;; In these cases, we do not have to do anything
list
(let* ((do-prop (>= show-classes 0))
(do-buf (not (= show-classes 0)))
- (do-dots t)
- (inherit (if (and (not (eq type 'class-tag)) super-classes)
- (cons class-selector super-classes)))
+ ;; (do-dots t)
+ (inherit (if (and (not (eq type 'class-tag)) idlwave--super-classes)
+ (cons idlwave--class-selector idlwave--super-classes)))
(max (abs show-classes))
- (lmax (if do-dots (apply 'max (mapcar 'length list))))
+ (lmax ;; (if do-dots
+ (apply #'max (mapcar #'length list))) ;;)
classes nclasses class-info space)
(mapcar
(lambda (x)
;; Just one class for tags
(setq classes
(list
- (idlwave-class-or-superclass-with-tag class-selector x)))
+ (idlwave-class-or-superclass-with-tag
+ idlwave--class-selector x)))
;; Multiple classes for method or method-keyword
(setq classes
(if (eq type 'kwd)
(idlwave-all-method-keyword-classes
- method-selector x type-selector)
- (idlwave-all-method-classes x type-selector)))
+ idlwave--method-selector x idlwave--type-selector)
+ (idlwave-all-method-classes x idlwave--type-selector)))
(if inherit
(setq classes
(delq nil
classes)))))
(setq nclasses (length classes))
;; Make the separator between item and class-info
- (if do-dots
- (setq space (concat " " (make-string (- lmax (length x)) ?.)))
- (setq space " "))
+ ;; (if do-dots
+ (setq space (concat " " (make-string (- lmax (length x)) ?.)))
+ ;; (setq space " "))
(if do-buf
;; We do want info in the buffer
(if (<= nclasses max)
(setq class-info (concat
space
- "<" (mapconcat 'identity classes ",") ">"))
+ "<" (mapconcat #'identity classes ",") ">"))
(setq class-info (format "%s<%d classes>" space nclasses)))
(setq class-info nil))
(when do-prop
;; We do want properties
(setq x (copy-sequence x))
(put-text-property 0 (length x)
- 'help-echo (mapconcat 'identity classes " ")
+ 'help-echo (mapconcat #'identity classes " ")
x))
(if class-info
(list x class-info)
(nth 2 last-command))
(progn
(select-window win)
- (eval idlwave-complete-after-success-form))
+ (funcall idlwave--complete-after-success-function))
(set-window-start cwin (point-min)))))
(and message (message "%s" message)))
(select-window win))))
(skip-chars-backward "a-zA-Z0-9_")
(point))))
(remove-text-properties beg (point) '(face nil))))
- (eval idlwave-complete-after-success-form-force))
+ (funcall idlwave--complete-after-success-force-function))
(defun idlwave-keyboard-quit ()
(interactive)
(defun idlwave-local-value (var &optional buffer)
"Return the value of VAR in BUFFER, but only if VAR is local to BUFFER."
- (with-current-buffer (or buffer (current-buffer))
- (and (local-variable-p var (current-buffer))
- (symbol-value var))))
+ (when (local-variable-p var buffer)
+ (buffer-local-value var (or buffer (current-buffer)))))
(defvar idlwave-completion-map nil
"Keymap for `completion-list-mode' with `idlwave-complete'.")
-(defun idlwave-default-choose-completion (&rest args)
- "Execute `default-choose-completion' and then restore the win-conf."
- (apply 'idlwave-choose 'default-choose-completion args))
+;; (defun idlwave-default-choose-completion (&rest args)
+;; "Execute `default-choose-completion' and then restore the win-conf."
+;; (apply #'idlwave-choose #'default-choose-completion args))
(define-obsolete-function-alias 'idlwave-display-completion-list-emacs
#'idlwave-display-completion-list-1 "28.1")
"Replace `choose-completion' in OLD-MAP."
(let ((new-map (copy-keymap old-map)))
(substitute-key-definition
- 'choose-completion 'idlwave-choose-completion new-map)
- (define-key new-map [mouse-3] 'idlwave-mouse-completion-help)
+ #'choose-completion #'idlwave-choose-completion new-map)
+ (define-key new-map [mouse-3] #'idlwave-mouse-completion-help)
new-map))
(defun idlwave-choose-completion (&rest args)
"Choose the completion that point is in or next to."
(interactive (list last-nonmenu-event))
- (apply 'idlwave-choose 'choose-completion args))
+ (apply #'idlwave-choose #'choose-completion args))
(define-obsolete-function-alias 'idlwave-mouse-choose-completion
#'idlwave-choose-completion "28.1")
(defun idlwave-all-class-tags (class)
"Return a list of native and inherited tags in CLASS."
(condition-case err
- (apply 'append (mapcar 'idlwave-class-tags
- (cons class (idlwave-all-class-inherits class))))
+ (apply #'append (mapcar #'idlwave-class-tags
+ (cons class (idlwave-all-class-inherits class))))
(error
(idlwave-class-tag-reset)
(error "%s" (error-message-string err)))))
(defvar idlwave-current-class-tags nil)
(defvar idlwave-current-native-class-tags nil)
(defvar idlwave-sint-class-tags nil)
-(declare-function idlwave-sintern-class-tag "idlwave" t t)
-(idlwave-new-sintern-type 'class-tag)
-(add-to-list 'idlwave-complete-special 'idlwave-complete-class-structure-tag)
-(add-hook 'idlwave-update-rinfo-hook 'idlwave-class-tag-reset)
+(idlwave-new-sintern-type class-tag)
+(add-hook 'idlwave-complete-functions #'idlwave-complete-class-structure-tag)
+(add-hook 'idlwave-update-rinfo-hook #'idlwave-class-tag-reset)
(defun idlwave-complete-class-structure-tag ()
"Complete a structure tag on a `self' argument in an object method."
(skip-chars-backward "a-zA-Z0-9._$")
(and (< (point) (- pos 4))
(looking-at "self\\.")))
- (let* ((class-selector (nth 2 (idlwave-current-routine)))
- (super-classes (idlwave-all-class-inherits class-selector)))
+ (let* ((idlwave--class-selector (nth 2 (idlwave-current-routine)))
+ (idlwave--super-classes (idlwave-all-class-inherits
+ idlwave--class-selector)))
;; Check if we are in a class routine
- (unless class-selector
+ (unless idlwave--class-selector
(error "Not in a method procedure or function"))
;; Check if we need to update the "current" class
- (if (not (equal class-selector idlwave-current-tags-class))
- (idlwave-prepare-class-tag-completion class-selector))
+ (if (not (equal idlwave--class-selector idlwave-current-tags-class))
+ (idlwave-prepare-class-tag-completion idlwave--class-selector))
(setq idlwave-completion-help-info
(list 'idlwave-complete-class-structure-tag-help
(idlwave-sintern-routine
- (concat class-selector "__define"))
+ (concat idlwave--class-selector "__define"))
nil))
;; FIXME: idlwave-cpl-bold doesn't seem used anywhere.
- (let ((idlwave-cpl-bold idlwave-current-native-class-tags))
+ (let ((_idlwave-cpl-bold idlwave-current-native-class-tags))
(idlwave-complete-in-buffer
'class-tag 'class-tag
idlwave-current-class-tags nil
- (format "Select a tag of class %s" class-selector)
+ (format "Select a tag of class %s" idlwave--class-selector)
"class tag"
'idlwave-attach-class-tag-classes))
t) ; return t to skip other completions
(list (idlwave-sintern-class-tag x 'set)))
(idlwave-all-class-tags class)))
(setq idlwave-current-native-class-tags
- (mapcar 'downcase (idlwave-class-tags class))))
+ (mapcar #'downcase (idlwave-class-tags class))))
;===========================================================================
;;
(defvar idlwave-sint-sysvars nil)
(defvar idlwave-sint-sysvartags nil)
-(declare-function idlwave-sintern-sysvar "idlwave" t t)
-(declare-function idlwave-sintern-sysvartag "idlwave" t t)
-(idlwave-new-sintern-type 'sysvar)
-(idlwave-new-sintern-type 'sysvartag)
-(add-to-list 'idlwave-complete-special 'idlwave-complete-sysvar-or-tag)
-(add-hook 'idlwave-update-rinfo-hook 'idlwave-sysvars-reset)
-(add-hook 'idlwave-after-load-rinfo-hook 'idlwave-sintern-sysvar-alist)
+(idlwave-new-sintern-type sysvar)
+(idlwave-new-sintern-type sysvartag)
+(add-hook 'idlwave-complete-functions #'idlwave-complete-sysvar-or-tag)
+(add-hook 'idlwave-update-rinfo-hook #'idlwave-sysvars-reset)
+(add-hook 'idlwave-after-load-rinfo-hook #'idlwave-sintern-sysvar-alist)
(defun idlwave-complete-sysvar-or-tag ()
(let ((text idlwave-shell-command-output)
(start 0)
(old idlwave-system-variables-alist)
- var tags type name class link old-entry)
+ var tags link old-entry) ;; type name class
(setq idlwave-system-variables-alist nil)
(while (string-match "^IDLWAVE-SYSVAR: !\\([a-zA-Z0-9_$]+\\)\\( \\(.*\\)\\)?"
text start)
(cdr (assq
(idlwave-sintern-sysvartag x)
(cdr (assq 'tags old-entry))))))
- tags)) link)
+ tags))
+ link)
idlwave-system-variables-alist)))
;; Keep the old value if query was not successful
(setq idlwave-system-variables-alist
(setq this-command last-command)
(idlwave-do-mouse-completion-help ev))
-(defun idlwave-routine-info (&optional arg external)
+(defun idlwave-routine-info (&optional arg _external)
"Display a routines calling sequence and list of keywords.
When point is on the name a function or procedure, or in the argument
list of a function or procedure, this command displays a help buffer with
(idlwave-force-class-query (equal arg '(4)))
(module (idlwave-what-module)))
(if (car module)
- (apply 'idlwave-display-calling-sequence
+ (apply #'idlwave-display-calling-sequence
(idlwave-fix-module-if-obj_new module))
(error "Don't know which calling sequence to show")))))
(stringp class))
(list (car module)
(nth 1 module)
- (apply 'idlwave-find-inherited-class module))
+ (apply #'idlwave-find-inherited-class module))
module)))
(defun idlwave-find-inherited-class (name type class)
(setq string (buffer-substring (point) pos))
(string-match "obj_new([^'\"]*['\"]\\([a-zA-Z0-9_]+\\)"
string)))
- (let ((name "Init")
+ (let (;; (name "Init")
(class (match-string 1 string)))
(setq module (list (idlwave-sintern-method "Init")
'fun
Translate OBJ_NEW, adding all super-class keywords, or all keywords
from all classes if CLASS equals t. If SYSTEM is non-nil, don't
demand _EXTRA in the keyword list."
- (let ((case-fold-search t))
+ (let ((case-fold-search t)
+ (idlwave--super-classes super-classes))
;; If this is the OBJ_NEW function, try to figure out the class and use
;; the keywords from the corresponding INIT method.
(idlwave-sintern-method "INIT")
'fun
class
- (idlwave-routines)) 'do-link))))))
+ (idlwave-routines))
+ 'do-link))))))
;; If the class is t, combine all keywords of all methods NAME
(when (eq class t)
;; If we have inheritance, add all keywords from superclasses, if
;; the user indicated that method in `idlwave-keyword-class-inheritance'
(when (and
- super-classes
+ idlwave--super-classes
idlwave-keyword-class-inheritance
(stringp class)
(or
(cl-loop for entry in (idlwave-routines) do
(and (nth 2 entry) ; non-nil class
- (memq (nth 2 entry) super-classes) ; an inherited class
+ (memq (nth 2 entry) idlwave--super-classes) ;an inherited class
(eq (nth 1 entry) type) ; correct type
(eq (car entry) name) ; correct name
(mapc (lambda (k) (add-to-list 'keywords k))
(defvar idlwave-rinfo-mouse-map
(let ((map (make-sparse-keymap)))
- (define-key map [mouse-2] 'idlwave-mouse-active-rinfo)
- (define-key map [(shift mouse-2)] 'idlwave-mouse-active-rinfo-shift)
- (define-key map [mouse-3] 'idlwave-mouse-active-rinfo-right)
- (define-key map " " 'idlwave-active-rinfo-space)
- (define-key map "q" 'idlwave-quit-help)
+ (define-key map [mouse-2] #'idlwave-mouse-active-rinfo)
+ (define-key map [(shift mouse-2)] #'idlwave-mouse-active-rinfo-shift)
+ (define-key map [mouse-3] #'idlwave-mouse-active-rinfo-right)
+ (define-key map " " #'idlwave-active-rinfo-space)
+ (define-key map "q" #'idlwave-quit-help)
map))
(defvar idlwave-rinfo-map
(let ((map (make-sparse-keymap)))
- (define-key map "q" 'idlwave-quit-help)
+ (define-key map "q" #'idlwave-quit-help)
map))
(defvar idlwave-popup-source nil)
(data (list name type class (current-buffer) nil initial-class))
(face 'idlwave-help-link)
beg props win cnt total)
- ;; Fix keywords, but don't add chained super-classes, since these
+ ;; Fix keywords, but don't add chained idlwave--super-classes, since these
;; are shown separately for that super-class
(setq keywords (idlwave-fix-keywords name type class keywords))
(cond
(add-text-properties beg (point) (list 'face 'bold)))
(when (and file (not (equal file "")))
(setq beg (point))
- (insert (apply 'abbreviate-file-name (list file)))
+ (insert (apply #'abbreviate-file-name (list file)))
(if file-props
(add-text-properties beg (point) file-props)))))
idlwave-keyword-completion-adds-equal)
(insert "=")))))
-(defun idlwave-list-buffer-load-path-shadows (&optional arg)
+(defun idlwave-list-buffer-load-path-shadows (&optional _arg)
"List the load path shadows of all routines defined in current buffer."
- (interactive "P")
+ (interactive)
(idlwave-routines)
(if (derived-mode-p 'idlwave-mode)
(idlwave-list-load-path-shadows
"in current buffer")
(error "Current buffer is not in idlwave-mode")))
-(defun idlwave-list-shell-load-path-shadows (&optional arg)
+(defun idlwave-list-shell-load-path-shadows (&optional _arg)
"List the load path shadows of all routines compiled under the shell.
This is very useful for checking an IDL application. Just compile the
application, do RESOLVE_ALL, and `C-c C-i' to compile all referenced
routines and update IDLWAVE internal info. Then check for shadowing
with this command."
- (interactive "P")
+ (interactive)
(cond
((or (not (fboundp 'idlwave-shell-is-running))
(not (idlwave-shell-is-running)))
(idlwave-list-load-path-shadows nil idlwave-compiled-routines
"in the shell"))))
-(defun idlwave-list-all-load-path-shadows (&optional arg)
+(defun idlwave-list-all-load-path-shadows (&optional _arg)
"List the load path shadows of all routines known to IDLWAVE."
- (interactive "P")
+ (interactive)
(idlwave-list-load-path-shadows nil nil "globally"))
(defvar idlwave-sort-prefer-buffer-info t
"Internal variable used to influence `idlwave-routine-twin-compare'.")
-(defun idlwave-list-load-path-shadows (arg &optional special-routines loc)
+(defun idlwave-list-load-path-shadows (_arg &optional special-routines loc)
"List the routines which are defined multiple times.
Search the information IDLWAVE has about IDL routines for multiple
definitions.
(lambda (ev)
(interactive "e")
(mouse-set-point ev)
- (apply 'idlwave-do-find-module
+ (apply #'idlwave-do-find-module
(get-text-property (point) 'find-args))))
(define-key keymap [(return)]
(lambda ()
(interactive)
- (apply 'idlwave-do-find-module
+ (apply #'idlwave-do-find-module
(get-text-property (point) 'find-args))))
(message "Compiling list...( 0%%)")
(with-current-buffer (get-buffer-create "*Shadows*")
(push candidate twins))
(cons entry (nreverse twins))))
+;; Bound in idlwave-study-twins,idlwave-routine-entry-compare-twins.
+(defvar idlwave-twin-class)
+(defvar idlwave-twin-name)
+
(defun idlwave-study-twins (entries)
"Return dangerous twins of first entry in ENTRIES.
Dangerous twins are routines with same name, but in different files on
(type (nth 1 entry)) ; Must be bound for
(idlwave-twin-class (nth 2 entry)) ; idlwave-routine-twin-compare
(cnt 0)
- source type type-cons file alist syslibp key)
+ source type-cons file alist syslibp key)
(while (setq entry (pop entries))
(cl-incf cnt)
(setq source (nth 3 entry)
(when (and (idlwave-syslib-scanned-p)
(setq entry (assoc 'system alist)))
(setcar entry 'builtin))
- (sort alist 'idlwave-routine-twin-compare)))
+ (sort alist #'idlwave-routine-twin-compare)))
;; FIXME: Dynamically scoped vars need to use the `idlwave-' prefix.
;; (defvar type)
-(define-obsolete-function-alias 'idlwave-xor 'xor "27.1")
+(define-obsolete-function-alias 'idlwave-xor #'xor "27.1")
(defun idlwave-routine-entry-compare (a b)
"Compare two routine info entries for sorting.
"Compare two routine entries, under the assumption that they are twins.
This basically calls `idlwave-routine-twin-compare' with the correct args."
(let* ((idlwave-twin-name (car a))
- (type (nth 1 a))
+ ;; (type (nth 1 a))
(idlwave-twin-class (nth 2 a)) ; used in idlwave-routine-twin-compare
(asrc (nth 3 a))
(atype (car asrc))
(list (file-truename bfile) bfile (list btype))
(list btype bfile (list btype))))))
-;; Bound in idlwave-study-twins,idlwave-routine-entry-compare-twins.
-(defvar idlwave-twin-class)
-(defvar idlwave-twin-name)
-
(defun idlwave-routine-twin-compare (a b)
"Compare two routine twin entries for sorting.
In here, A and B are not normal routine info entries, but special
(defun idlwave-path-alist-add-flag (list-entry flag)
"Add a flag to the path list entry, if not set."
- (let ((flags (cdr list-entry)))
- (add-to-list 'flags flag)
- (setcdr list-entry flags)))
+ (cl-pushnew flag (cdr list-entry) :test #'equal))
(defun idlwave-path-alist-remove-flag (list-entry flag)
"Remove a flag to the path list entry, if set."
["(Un)Comment Region" idlwave-toggle-comment-region t]
["Continue/Split line" idlwave-split-line t]
"--"
- ["Toggle Auto Fill" idlwave-auto-fill-mode :style toggle
- :selected (symbol-value idlwave-fill-function)])
+ ["Toggle Auto Fill" auto-fill-mode :style toggle
+ :selected auto-fill-function])
("Templates"
["Procedure" idlwave-procedure t]
["Function" idlwave-function t]
This function was written since `list-abbrevs' looks terrible for IDLWAVE mode."
(interactive "P")
- (let ((table (symbol-value 'idlwave-mode-abbrev-table))
+ (let ((table idlwave-mode-abbrev-table)
abbrevs
str rpl func fmt (len-str 0) (len-rpl 0))
(mapatoms