• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /macosx-10.9.5/emacs-92/emacs/lisp/

Lines Matching +defs:buffer +defs:file +defs:format

9 ;; This file is part of GNU Emacs.
22 ;; along with GNU Emacs; see the file COPYING. If not, write to the
44 "*Name of a change log file for \\[add-change-log-entry]."
84 (defcustom add-log-time-format 'add-log-iso8601-time-string
85 "Function that defines the time format.
87 date in international ISO 8601 format,
89 :type '(radio (const :tag "International ISO 8601 format"
91 (const :tag "Old format, as returned by `current-time-string'"
97 "If non-nil, normally keep day's log entries for one file together.
99 Log entries for a given file made with \\[add-change-log-entry] or
101 for that file made
102 today if this variable is non-nil or that file comes first in today's
103 entries. Otherwise another entry for that file will be started. An
110 buffer visiting `bar', yields:
134 (defcustom add-log-buffer-file-name-function nil
135 "If non-nil, function to call to identify the full filename of a buffer.
137 use `buffer-file-name'."
141 (defcustom add-log-file-name-function nil
144 `buffer-file-name' in that buffer. If this is nil, the default is to
145 use the file's name relative to the directory of the change log file."
165 Note: The search is conducted only within 10%, at the beginning of the file."
194 (defface change-log-file
196 "Face for highlighting file names."
200 (put 'change-log-file-face 'face-alias 'change-log-file)
240 ;; work if a user customizes add-log-time-format.
250 (2 'change-log-file)
252 ("\\=, \\([^ ,:([\n]+\\)" nil nil (1 'change-log-file))
293 It takes the same format as the TZ argument of `set-time-zone-rule'.
307 (format (cond ((not (zerop ss)) "%c%02d:%02d:%02d")
315 (let ((time (format-time-string "%Y-%m-%d"
322 "Return (system-dependent) default name for a change log file."
357 (name (expand-file-name
358 (read-file-name (format "Log file (default %s): " default)
362 (if (string= (file-name-nondirectory name) "")
363 (expand-file-name (file-name-nondirectory default)
365 ;; Handle specifying a file that is a directory.
366 (if (file-directory-p name)
367 (expand-file-name (file-name-nondirectory default)
368 (file-name-as-directory name))
372 "Return version number of current buffer's file.
375 (let* ((size (buffer-size))
377 ;; The version number can be anywhere in the file, but
378 ;; restrict search to the file beginning: 10% should be
381 ;; Apply percentage only if buffer size is bigger than
384 (or (and buffer-file-name (vc-workfile-version buffer-file-name))
399 (defun find-change-log (&optional file-name buffer-file)
400 "Find a change log file for \\[add-change-log-entry] and return the name.
402 Optional arg FILE-NAME specifies the file to use.
409 directory and its successive parents for a file so named.
411 Once a file is found, `change-log-default-name' is set locally in the
412 current buffer to the complete file name.
413 Optional arg BUFFER-FILE overrides `buffer-file-name'."
414 ;; If user specified a file name or if this buffer knows which one to use,
416 (or file-name
417 (setq file-name (and change-log-default-name
418 (file-name-directory change-log-default-name)
421 ;; Chase links in the source file
423 (setq file-name (or (and (or buffer-file buffer-file-name)
424 (file-name-directory
425 (file-chase-links
426 (or buffer-file buffer-file-name))))
428 (if (file-directory-p file-name)
429 (setq file-name (expand-file-name (change-log-name) file-name)))
430 ;; Chase links before visiting the file.
431 ;; This makes it easier to use a single change log file
433 (setq file-name (file-chase-links file-name))
434 (setq file-name (expand-file-name file-name))
435 ;; Move up in the dir hierarchy till we find a change log file.
436 (let ((file1 file-name)
438 (while (and (not (or (get-file-buffer file1) (file-exists-p file1)))
440 (file-name-directory
441 (directory-file-name
442 (file-name-directory file1))))
444 (not (string= (file-name-directory file1)
447 (setq file1 (expand-file-name
448 (file-name-nondirectory (change-log-name))
451 (if (or (get-file-buffer file1) (file-exists-p file1))
452 (setq file-name file1)))))
453 ;; Make a local variable in this buffer so we needn't search again.
454 (set (make-local-variable 'change-log-default-name) file-name)
455 file-name)
457 (defun add-log-file-name (buffer-file log-file)
458 ;; Never want to add a change log entry for the ChangeLog file itself.
459 (unless (or (null buffer-file) (string= buffer-file log-file))
460 (if add-log-file-name-function
461 (funcall add-log-file-name-function buffer-file)
462 (setq buffer-file
464 (concat "^" (regexp-quote (file-name-directory log-file)))
465 buffer-file)
466 (substring buffer-file (match-end 0))
467 (file-name-nondirectory buffer-file)))
468 ;; If we have a backup file, it's presumably because we're
471 (if (backup-file-name-p buffer-file)
472 (file-name-sans-versions buffer-file)
473 buffer-file))))
476 (defun add-change-log-entry (&optional whoami file-name other-window new-entry)
477 "Find change log file, and add an entry for today and an item for this file.
481 Second arg FILE-NAME is file name of the change log.
494 The change log file can start with a copyright notice and a copying
505 (buf-file-name (if add-log-buffer-file-name-function
506 (funcall add-log-buffer-file-name-function)
507 buffer-file-name))
508 (buffer-file (if buf-file-name (expand-file-name buf-file-name)))
509 (file-name (expand-file-name (find-change-log file-name buffer-file)))
510 ;; Set ITEM to the file name to use in the new item.
511 (item (add-log-file-name buffer-file file-name))
526 (unless (equal file-name buffer-file-name)
528 (find-file-other-window file-name)
529 (find-file file-name)))
535 ;; If file starts with a copyright and permission notice, skip them.
550 (funcall add-log-time-format))
552 (funcall add-log-time-format))
578 (forward-paragraph))) ; paragraph delimits entries for file
583 ;; Put this file name into the existing empty item.
594 ;; Add to the existing item for the same file.
618 ;; Point is at the item for this file,
640 (when (equal (buffer-substring pos (point)) defun)
655 (defun add-change-log-entry-other-window (&optional whoami file-name)
656 "Find change log file in other window and add entry and item.
658 the change log file in another window."
662 (add-change-log-entry whoami file-name t))
674 ;; Matching the output of add-log-time-format is difficult,
795 (buffer-substring-no-properties (point)
813 (buffer-substring-no-properties (point)
874 ;; DEFUN ("file-name-directory", Ffile_name_directory, Sfile_name_directory, ...) ==> Ffile_name_directory
882 (buffer-substring-no-properties
934 (string= (buffer-substring (- middle 2)
956 (buffer-substring-no-properties
964 (buffer-substring-no-properties
1002 ;; Add the last match in the buffer to the end of `md',
1045 (let ((buf (current-buffer)))
1046 (with-temp-buffer
1047 (insert-buffer-substring buf (match-beginning 1) (match-end 1))
1049 (let ((other-buf (current-buffer)))
1050 (with-current-buffer buf
1059 "Merge the contents of change log file OTHER-LOG with this buffer.
1061 the appropriate motion commands). OTHER-LOG can be either a file name
1062 or a buffer.
1066 (interactive "*fLog file name to merge: ")
1070 (find-file-noselect other-log)))
1071 (buf (current-buffer))
1075 (set-buffer other-buf)
1084 ;; Look for an entry in original buffer that isn't later.
1085 (with-current-buffer buf
1090 (insert-buffer-substring other-buf start end)
1091 ;; At the end of the original buffer, insert a newline to
1092 ;; separate entries and then the rest of the file being
1100 (with-current-buffer other-buf
1102 (insert-buffer-substring other-buf start)))))))
1106 "Fix any old-style date entries in the current log file to default format."
1117 (replace-match (format-time-string