"which" "who" "whos")
"Text functions in Octave.")
-(defvar octave-variables
- '("DEFAULT_EXEC_PATH" "DEFAULT_LOADPATH"
- "EDITOR" "EXEC_PATH" "F_DUPFD" "F_GETFD" "F_GETFL" "F_SETFD"
- "F_SETFL" "I" "IMAGE_PATH" "Inf" "J"
- "NaN" "OCTAVE_VERSION" "O_APPEND" "O_CREAT" "O_EXCL"
- "O_NONBLOCK" "O_RDONLY" "O_RDWR" "O_TRUNC" "O_WRONLY" "PAGER" "PS1"
- "PS2" "PS4" "PWD" "SEEK_CUR" "SEEK_END" "SEEK_SET" "__F_DUPFD__"
- "__F_GETFD__" "__F_GETFL__" "__F_SETFD__" "__F_SETFL__" "__I__"
- "__Inf__" "__J__" "__NaN__" "__OCTAVE_VERSION__" "__O_APPEND__"
- "__O_CREAT__" "__O_EXCL__" "__O_NONBLOCK__" "__O_RDONLY__"
- "__O_RDWR__" "__O_TRUNC__" "__O_WRONLY__" "__PWD__" "__SEEK_CUR__"
- "__SEEK_END__" "__SEEK_SET__" "__argv__" "__e__" "__eps__"
- "__i__" "__inf__" "__j__" "__nan__" "__pi__"
- "__program_invocation_name__" "__program_name__" "__realmax__"
- "__realmin__" "__stderr__" "__stdin__" "__stdout__" "ans" "argv"
- "beep_on_error" "completion_append_char"
- "crash_dumps_octave_core" "default_save_format"
- "e" "echo_executing_commands" "eps"
- "error_text" "gnuplot_binary" "history_file"
- "history_size" "ignore_function_time_stamp"
- "inf" "nan" "nargin" "output_max_field_width" "output_precision"
- "page_output_immediately" "page_screen_output" "pi"
- "print_answer_id_name" "print_empty_dimensions"
- "program_invocation_name" "program_name"
- "realmax" "realmin" "return_last_computed_value" "save_precision"
- "saving_history" "sighup_dumps_octave_core" "sigterm_dumps_octave_core"
- "silent_functions" "split_long_rows" "stderr" "stdin" "stdout"
- "string_fill_char" "struct_levels_to_print"
- "suppress_verbose_help_message")
- "Builtin variables in Octave.")
-
(defvar octave-function-header-regexp
(concat "^\\s-*\\_<\\(function\\)\\_>"
"\\([^=;\n]*=[ \t]*\\|[ \t]*\\)\\(\\(?:\\w\\|\\s_\\)+\\)\\_>")
(if (boundp 'font-lock-builtin-face)
'font-lock-builtin-face
'font-lock-preprocessor-face))
- ;; Fontify all builtin variables.
- (cons (concat "\\_<" (regexp-opt octave-variables) "\\_>")
- 'font-lock-variable-name-face)
;; Fontify all function declarations.
(list octave-function-header-regexp
'(1 font-lock-keyword-face)
table)
"Syntax table in use in `octave-mode' buffers.")
+(defcustom octave-font-lock-texinfo-comment t
+ "Control whether to highlight the texinfo comment block."
+ :type 'boolean
+ :group 'octave
+ :version "24.4")
+
(defcustom octave-blink-matching-block t
"Control the blinking of matching Octave block keywords.
Non-nil means show matching begin of block when inserting a space,
'octave-completion-at-point-function nil t)
(add-hook 'before-save-hook 'octave-sync-function-file-names nil t)
(setq-local beginning-of-defun-function 'octave-beginning-of-defun)
+ (and octave-font-lock-texinfo-comment (octave-font-lock-texinfo-comment))
(easy-menu-add octave-mode-menu))
nil 'delimited nil nil beg end)
(message "Function names match")))))
+;; Adapted from texinfo-font-lock-keywords
+(defvar octave-texinfo-font-lock-keywords
+ `(("@\\([a-zA-Z]+\\|[^ \t\n]\\)" 1 font-lock-keyword-face prepend) ;commands
+ ("^\\*\\([^\n:]*\\)" 1 font-lock-function-name-face prepend) ;menu items
+ ("@\\(emph\\|i\\|sc\\){\\([^}]+\\)" 2 'italic prepend)
+ ("@\\(strong\\|b\\){\\([^}]+\\)" 2 'bold prepend)
+ ("@\\(kbd\\|key\\|url\\|uref\\){\\([^}]+\\)"
+ 2 font-lock-string-face prepend)
+ ("@\\(file\\|email\\){\\([^}]+\\)" 2 font-lock-string-face prepend)
+ ("@\\(samp\\|code\\|var\\|math\\|env\\|command\\|option\\){\\([^}]+\\)"
+ 2 font-lock-variable-name-face prepend)
+ ("@\\(cite\\|x?ref\\|pxref\\|dfn\\|inforef\\){\\([^}]+\\)"
+ 2 font-lock-constant-face prepend)
+ ("@\\(anchor\\){\\([^}]+\\)" 2 font-lock-type-face prepend)
+ ("@\\(dmn\\|acronym\\|value\\){\\([^}]+\\)"
+ 2 font-lock-builtin-face prepend)
+ ("@\\(end\\|itemx?\\) +\\(.+\\)" 2 font-lock-keyword-face prepend))
+ "Additional keywords to highlight in texinfo comment block.")
+
+(defface octave-function-comment-block
+ '((t (:inherit font-lock-doc-face)))
+ "Face used to highlight function comment block."
+ :group 'octave)
+
+(defun octave-font-lock-texinfo-comment ()
+ (font-lock-add-keywords
+ nil
+ '(((lambda (limit)
+ (while (and (search-forward "-*- texinfo -*-" limit t)
+ (octave-in-comment-p))
+ (let ((beg (nth 8 (syntax-ppss)))
+ (end (progn
+ (octave-skip-comment-forward (point-max))
+ (point))))
+ (put-text-property beg end 'font-lock-multiline t)
+ (font-lock-prepend-text-property
+ beg end 'face 'octave-function-comment-block)
+ (dolist (kw octave-texinfo-font-lock-keywords)
+ (goto-char beg)
+ (while (re-search-forward (car kw) end 'move)
+ (font-lock-apply-highlight (cdr kw))))))
+ nil)))
+ 'append))
+
\f
;;; Indentation
(process-live-p inferior-octave-process)
(inferior-octave-completion-table))
(append octave-reserved-words
- octave-text-functions
- octave-variables)))))
+ octave-text-functions)))))
(define-obsolete-function-alias 'octave-complete-symbol
'completion-at-point "24.1")