It takes the same format as the TZ argument of `set-time-zone-rule'.
If nil, use local time.")
+(defvar add-log-debugging)
+
(defun add-log-iso8601-time-zone (time)
(let* ((utc-offset (or (car (current-time-zone time)) 0))
(sign (if (< utc-offset 0) ?- ?+))
(substring buffer-file-name (match-end 0))
(file-name-nondirectory buffer-file-name))))
+ (let ((buffer (find-buffer-visiting file-name)))
+ (setq add-log-debugging (list (gap-position) (gap-size))))
(if (and other-window (not (equal file-name buffer-file-name)))
(find-file-other-window file-name)
(find-file file-name))
(or (eobp) (forward-char 1))
(beginning-of-defun)
;; Make sure we are really inside the defun found, not after it.
- (if (and (looking-at "\\s(")
- (progn (end-of-defun)
- (< location (point)))
- (progn (forward-sexp -1)
- (>= location (point))))
- (progn
- (if (looking-at "\\s(")
- (forward-char 1))
- (forward-sexp 1)
- (skip-chars-forward " '")
- (buffer-substring (point)
- (progn (forward-sexp 1) (point))))))
+ (when (and (looking-at "\\s(")
+ (progn (end-of-defun)
+ (< location (point)))
+ (progn (forward-sexp -1)
+ (>= location (point))))
+ (if (looking-at "\\s(")
+ (forward-char 1))
+ ;; Skip the defining construct name, typically "defun"
+ ;; or "defvar".
+ (forward-sexp 1)
+ ;; The second element is usually a symbol being defined.
+ ;; If it is not, use the first symbol in it.
+ (skip-chars-forward " \t\n'(")
+ (buffer-substring (point)
+ (progn (forward-sexp 1)
+ (point)))))
((and (memq major-mode add-log-c-like-modes)
(save-excursion
(beginning-of-line)
(let ((case-fold-search t)) ; case-insensitive
;; search for fortran subprogram start
(if (re-search-forward
- "^[ \t]*\\(program\\|subroutine\\|function\
+ "^[ \t]*\\(program\\|subroutine\\|function\
\\|[ \ta-z0-9*()]*[ \t]+function\\|\\(block[ \t]*data\\)\\)"
- (progn (end-of-fortran-subprogram)
- (point))
- t)
+ (save-excursion (end-of-fortran-subprogram)
+ (point))
+ t)
(or (match-string 2)
- (progn
- ;; move to EOL or before first left paren
- (if (re-search-forward "[(\n]" nil t)
+ (progn
+ ;; move to EOL or before first left paren
+ (if (re-search-forward "[(\n]" nil t)
(progn (backward-char)
- (skip-chars-backward " \t"))
- (end-of-line))
- ;; Use the name preceding that.
- (buffer-substring (point)
+ (skip-chars-backward " \t"))
+ (end-of-line))
+ ;; Use the name preceding that.
+ (buffer-substring (point)
(progn (backward-sexp)
(point)))))
"main")))