[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#29935: 26.0.90; copyright-update adds year in middle of buffer

From: Stephen Leake
Subject: bug#29935: 26.0.90; copyright-update adds year in middle of buffer
Date: Mon, 01 Jan 2018 13:41:51 -0600

With copyright-update in before-save-hook, edit multiple files that need
a copyright update, then execute save-some-buffers.

In some of the files, the new copyright year is inserted in the middle
of the buffer (where point last was?), not in the copyright line.

See https://lists.gnu.org/archive/html/emacs-devel/2017-10/msg00848.html
for more discussion. The fix posted there is:

  --- copyright-orig.el 2017-10-31 18:54:20.957330092 +0100
  +++ copyright.el      2017-10-31 18:55:11.624754452 +0100
  @@ -181,19 +181,22 @@
     ;; This uses the match-data from copyright-find-copyright/end.
     (goto-char (match-end 1))
  +  (let ((copyright-end (point)))
     (setq copyright-current-year (format-time-string "%Y"))
     (unless (string= (buffer-substring (- (match-end 3) 2) (match-end 3))
                      (substring copyright-current-year -2))
       (if (or noquery
  +                (save-excursion
                 (switch-to-buffer (current-buffer))
                 ;; Fixes some point-moving oddness (bug#2209).
  -              (save-excursion
                   (y-or-n-p (if replace
                                 (concat "Replace copyright year(s) by "
                                         copyright-current-year "? ")
                               (concat "Add " copyright-current-year
                                       " to copyright? "))))))
  +          (progn
  +            (goto-char copyright-end)
           (if replace
               (replace-match copyright-current-year t t nil 3)
             (let ((size (save-excursion (skip-chars-backward "0-9"))))
  @@ -218,7 +221,7 @@
                 (if (eq (char-after (+ (point) size -3)) ?')
                     (insert ?')))
               ;; Finally insert the new year.
  -            (insert (substring copyright-current-year size)))))))
  +                (insert (substring copyright-current-year size)))))))))

   (defun copyright-update (&optional arg interactivep)

In GNU Emacs 26.0.90 (build 1, x86_64-w64-mingw32)
 of 2018-01-01 built on TAKVER4
Repository revision: 63b04c11d530f4a6a41f112d1b3ba1ed1eb81195
Windowing system distributor 'Microsoft Corp.', version 6.3.9600
Recent messages:
Mark set
Mark set
Mark set
Making completion list...
Mark saved where search started

Configured using:
 'configure --prefix=/c/emacs/emacs-26'

Configured features:

Important settings:
  value of $LANG: en_US.UTF-8
  locale-coding-system: cp1252

Major mode: Emacs-Lisp

Minor modes in effect:
  shell-dirtrack-mode: t
  xref-ada-mode: t
  diff-auto-refine-mode: t
  other-frame-window-mode: t
  display-time-mode: t
  delete-selection-mode: t
  icomplete-mode: t
  tooltip-mode: t
  global-eldoc-mode: t
  eldoc-mode: t
  electric-quote-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  line-number-mode: t
  transient-mark-mode: t

Load-path shadows:
c:/Projects/org.wisitoken.grammar_mode/autoloads hides 
c:/home/stephe/.emacs.d/elpa/ada-ref-man-2012.3/ada-ref-man hides 
c:/Projects/org.emacs.ada-mode.stephe-2/ada-xref hides 
c:/Projects/org.emacs.ada-mode.stephe-2/ada-stmt hides 
c:/Projects/org.emacs.ada-mode.stephe-2/ada-prj hides 
c:/Projects/org.emacs.ada-mode.stephe-2/ada-mode hides 

(shadow sort mail-extr emacsbug sendmail vc-git map help-fns radix-tree
copyright tabify shell ada-project env-project project-menu make-mode
misearch multi-isearch wisi-grammar-mode wisi_grammar-process
ada-process xref-ada ada-skel ada-skeletons skeleton ada-compiler
ada-gnat-compile gpr-query gnat-core ada-mode-compat ada-wisi
wisi-process-parse ada-indent-user-options ada-fix-error ada-elisp
wisi-elisp-parse wisi-compile wisi wisi-elisp-lexer wisi-parse-common
wisi-compat-24.2 semantic/lex semantic/fw mode-local ada-build ada-mode
find-file align cl-extra help-mode xmtn-dvc xmtn-conflicts xmtn-ids
dvc-persistence dvc-config xmtn-automate xmtn-run xmtn-match
xmtn-basic-io xmtn-base dvc-status dvc-diff dvc-log-edit vc ediff-merg
ediff-wind ediff-diff ediff-mult ediff-help ediff-init ediff-util ediff
add-log diff-mode dvc-propagate dvc-state vc-dispatcher vc-mtn org-rmail
org-mhe org-irc org-info org-gnus nnir gnus-sum gnus-group gnus-undo
gnus-start gnus-cloud nnimap nnmail mail-source tls gnutls utf7 netrc
nnoo parse-time gnus-spec gnus-int gnus-range message rmc puny rfc822
mml mml-sec epa derived epg mm-decode mm-bodies mm-encode mail-parse
rfc2231 mailabbrev gmm-utils mailheader gnus-win gnus nnheader gnus-util
rmail rmail-loaddefs rfc2047 rfc2045 ietf-drums mail-utils mm-util
mail-prsvr org-docview doc-view jka-compr image-mode org-bibtex bibtex
org-bbdb org-w3m org-element avl-tree generator org-mode-keys org advice
org-macro org-footnote org-pcomplete pcomplete org-list org-faces
org-entities org-version ob-emacs-lisp ob ob-tangle org-src ob-ref
ob-lob ob-table ob-keys ob-exp ob-comint ob-core ob-eval org-compat
org-macs org-loaddefs format-spec find-func cal-menu calendar
cal-loaddefs xgit-core xmtn-minimal dvc-autoloads dvc-unified ffap
thingatpt dvc-revlist dvc-fileinfo dvc-core dvc-buffers dvc-ui
dvc-register dvc-utils ewoc dvc-emacs dvc-defs other-frame-window
elec-pair time delsel cus-start cus-load color-theme edmacro kmacro
wid-edit cl noutline outline easy-mmode xref whitespace dired-x
dired-aux dired dired-loaddefs compile comint ansi-color ring
project-patches project uniquify-files path-iterator icomplete
finder-inf info package easymenu epg-config url-handlers url-parse
auth-source cl-seq eieio eieio-core cl-macs eieio-loaddefs
password-cache url-vars seq byte-opt gv bytecomp byte-compile cconv
cl-loaddefs cl-lib autoloads time-date mule-util tooltip eldoc electric
uniquify ediff-hook vc-hooks lisp-float-type mwheel dos-w32 ls-lisp
disp-table term/w32-win w32-win w32-vars term/common-win tool-bar dnd
fontset image regexp-opt fringe tabulated-list replace newcomment
text-mode elisp-mode lisp-mode prog-mode register page menu-bar
rfn-eshadow isearch timer select scroll-bar mouse jit-lock font-lock
syntax facemenu font-core term/tty-colors frame cl-generic cham georgian
utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao korean
japanese eucjp-ms cp51932 hebrew greek romanian slovak czech european
ethiopic indian cyrillic chinese composite charscript charprop
case-table epa-hook jka-cmpr-hook help simple abbrev obarray minibuffer
cl-preloaded nadvice loaddefs button faces cus-face macroexp files
text-properties overlay sha1 md5 base64 format env code-pages mule
custom widget hashtable-print-readable backquote w32notify w32 lcms2
multi-tty make-network-process emacs)

Memory information:
((conses 16 483260 59015)
 (symbols 56 42118 2)
 (miscs 48 767 834)
 (strings 32 109482 4257)
 (string-bytes 1 3118077)
 (vectors 16 43616)
 (vector-slots 8 835898 21082)
 (floats 8 349 609)
 (intervals 56 10467 182)
 (buffers 992 58))

reply via email to

[Prev in Thread] Current Thread [Next in Thread]