------------------------------------------------------------ revno: 117698 committer: Eric S. Raymond branch nick: trunk timestamp: Wed 2014-08-13 04:42:33 -0400 message: Add smerge support to the git back end. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2014-08-13 08:05:45 +0000 +++ lisp/ChangeLog 2014-08-13 08:42:33 +0000 @@ -1,8 +1,13 @@ 2014-08-13 Eric S. Raymond - * vc/vc-git.el (vc-git-conflicted-files): Integrate Rüdiger - Sonderfeld's code for detecting conflicted files using a status - listing. Useful in itself and a step towards better smerge + * vc/vc.git.el: (vc-git-find-file-hook): New function. Adds + support for calling smerge on a conflicted file, and calling git + add when there are no longer conflict markers in a saved file. + This is a completed version of Rüdiger Sonderfeld's proposal. + + * vc/vc-git.el (vc-git-conflicted-files): New function. Integrate + Rüdiger Sonderfeld's code for detecting conflicted files using a + status listing. Useful in itself and a step towards better smerge support. 2014-08-12 Stefan Monnier === modified file 'lisp/vc/vc-git.el' --- lisp/vc/vc-git.el 2014-08-13 08:05:45 +0000 +++ lisp/vc/vc-git.el 2014-08-13 08:42:33 +0000 @@ -101,7 +101,7 @@ ;; - clear-headers () NOT NEEDED ;; - delete-file (file) OK ;; - rename-file (old new) OK -;; - find-file-hook () NOT NEEDED +;; - find-file-hook () OK ;; - conflicted-files OK ;;; Code: @@ -786,6 +786,26 @@ "DU" "AA" "UU")) (push file files))))))) +(defun vc-git-resolve-when-done () + "Call \"git add\" if the conflict markers have been removed." + (save-excursion + (goto-char (point-min)) + (unless (re-search-forward "^<<<<<<< " nil t) + (vc-git-command nil 0 buffer-file-name "add") + ;; Remove the hook so that it is not called multiple times. + (remove-hook 'after-save-hook 'vc-git-resolve-when-done t)))) + +(defun vc-git-find-file-hook () + "Activate `smerge-mode' if there is a conflict." + (when (and buffer-file-name + (vc-git-conflicted-files buffer-file-name) + (save-excursion + (goto-char (point-min)) + (re-search-forward "^<<<<<<< " nil 'noerror))) + (vc-file-setprop buffer-file-name 'vc-state 'conflict) + (smerge-start-session) + (add-hook 'after-save-hook 'vc-git-resolve-when-done nil 'local) + (message "There are unresolved conflicts in this file"))) ;;; HISTORY FUNCTIONS ------------------------------------------------------------ revno: 117697 committer: Eric S. Raymond branch nick: trunk timestamp: Wed 2014-08-13 04:05:45 -0400 message: Integrate R?diger Sonderfeld's code for detecting conflicted files under git. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2014-08-12 16:16:00 +0000 +++ lisp/ChangeLog 2014-08-13 08:05:45 +0000 @@ -1,3 +1,10 @@ +2014-08-13 Eric S. Raymond + + * vc/vc-git.el (vc-git-conflicted-files): Integrate Rüdiger + Sonderfeld's code for detecting conflicted files using a status + listing. Useful in itself and a step towards better smerge + support. + 2014-08-12 Stefan Monnier * mpc.el (mpc-reorder): Don't bother splitting the "active"s elements === modified file 'lisp/vc/vc-git.el' --- lisp/vc/vc-git.el 2014-06-29 20:48:55 +0000 +++ lisp/vc/vc-git.el 2014-08-13 08:05:45 +0000 @@ -102,6 +102,7 @@ ;; - delete-file (file) OK ;; - rename-file (old new) OK ;; - find-file-hook () NOT NEEDED +;; - conflicted-files OK ;;; Code: @@ -769,6 +770,23 @@ (with-current-buffer buffer (vc-run-delayed (vc-compilation-mode 'git))) (vc-set-async-update buffer))) +(defun vc-git-conflicted-files (directory) + "Return the list of files with conflicts in DIRECTORY." + (let* ((status + (vc-git--run-command-string directory "status" "--porcelain" "--")) + (lines (split-string status "\n" 'omit-nulls)) + files) + (dolist (line lines files) + (when (string-match "\\([ MADRCU?!][ MADRCU?!]\\) \\(.+\\)\\(?: -> \\(.+\\)\\)?" + line) + (let ((state (match-string 1 line)) + (file (match-string 2 line))) + ;; See git-status(1). + (when (member state '("AU" "UD" "UA" ;; "DD" + "DU" "AA" "UU")) + (push file files))))))) + + ;;; HISTORY FUNCTIONS (autoload 'vc-setup-buffer "vc-dispatcher") ------------------------------------------------------------ revno: 117696 committer: Stefan Monnier branch nick: trunk timestamp: Tue 2014-08-12 12:16:00 -0400 message: * lisp/mpc.el (mpc-reorder): Don't bother splitting the "active" elements to the first part if they're the same as the selection. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2014-08-12 14:16:45 +0000 +++ lisp/ChangeLog 2014-08-12 16:16:00 +0000 @@ -1,3 +1,8 @@ +2014-08-12 Stefan Monnier + + * mpc.el (mpc-reorder): Don't bother splitting the "active"s elements + to the first part if they're the same as the selection. + 2014-08-12 Lars Magne Ingebrigtsen * image-mode.el (image-transform-reset): New command and menu item. @@ -2080,9 +2085,9 @@ 2014-05-30 Alan Mackenzie Guard (looking-at "\\s!") from XEmacs. - * progmodes/cc-engine.el (c-state-pp-to-literal): add guard form. + * progmodes/cc-engine.el (c-state-pp-to-literal): Add guard form. -2014-05-30 Ken Olum (tiny change) +2014-05-30 Ken Olum * mail/rmail.el (rmail-delete-forward, rmail-delete-backward): The argument COUNT is now optional, to be more backward-compatible. === modified file 'lisp/mpc.el' --- lisp/mpc.el 2014-05-12 13:25:53 +0000 +++ lisp/mpc.el 2014-08-12 16:16:00 +0000 @@ -1624,7 +1624,7 @@ (setq active (if (listp active) (mpc-intersection active vals) vals)))) - (when (and (listp active)) + (when (listp active) ;; Remove the selections if they are all in conflict with ;; other constraints. (let ((deactivate t)) @@ -1638,8 +1638,14 @@ (setq selection nil) (mapc 'delete-overlay mpc-select) (setq mpc-select nil) - (mpc-tagbrowser-all-select))))) + (mpc-tagbrowser-all-select)))) + ;; Don't bother splitting the "active" elements to the first part if + ;; they're the same as the selection. + (when (equal (sort (copy-sequence active) #'string-lessp) + (sort (copy-sequence selection) #'string-lessp)) + (setq active 'all))) + ;; FIXME: This `mpc-sort' takes a lot of time. Maybe we should ;; be more clever and presume the buffer is mostly sorted already. (mpc-sort (if (listp active) active)) ------------------------------------------------------------ revno: 117695 committer: Lars Magne Ingebrigtsen branch nick: trunk timestamp: Tue 2014-08-12 16:16:45 +0200 message: Allow resetting image transform options * image-mode.el (image-transform-reset): New command and menu item. (image-mode-map): Rearrange the menu items to put presumably more obscure items at the end. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2014-08-12 06:51:21 +0000 +++ lisp/ChangeLog 2014-08-12 14:16:45 +0000 @@ -1,3 +1,9 @@ +2014-08-12 Lars Magne Ingebrigtsen + + * image-mode.el (image-transform-reset): New command and menu item. + (image-mode-map): Rearrange the menu items to put presumably more + obscure items at the end. + 2014-08-12 Juri Linkov * vc/vc-annotate.el (vc-annotate-background-mode): === modified file 'lisp/image-mode.el' --- lisp/image-mode.el 2014-08-05 18:18:39 +0000 +++ lisp/image-mode.el 2014-08-12 14:16:45 +0000 @@ -379,8 +379,6 @@ ["Show as Text" image-toggle-display :active t :help "Show image as text"] "--" - ["Fit Frame to Image" image-mode-fit-frame :active t - :help "Resize frame to match image"] ["Fit to Window Height" image-transform-fit-to-height :visible (eq image-type 'imagemagick) :help "Resize image to match the window height"] @@ -390,6 +388,9 @@ ["Rotate Image..." image-transform-set-rotation :visible (eq image-type 'imagemagick) :help "Rotate the image"] + ["Reset Transformations" image-transform-reset + :visible (eq image-type 'imagemagick) + :help "Reset all image transformations"] "--" ["Show Thumbnails" (lambda () @@ -402,6 +403,9 @@ ["Previous Image" image-previous-file :active buffer-file-name :help "Move to previous image in this directory"] "--" + ["Fit Frame to Image" image-mode-fit-frame :active t + :help "Resize frame to match image"] + "--" ["Animate Image" image-toggle-animation :style toggle :selected (let ((image (image-get-display-property))) (and image (image-animate-timer image))) @@ -1097,6 +1101,16 @@ (setq image-transform-rotation (float (mod rotation 360))) (image-toggle-display-image)) +(defun image-transform-reset () + "Display the current image with the default size and rotation. +This command has no effect unless Emacs is compiled with +ImageMagick support." + (interactive) + (setq image-transform-resize nil + image-transform-rotation 0.0 + image-transform-scale 1) + (image-toggle-display-image)) + (provide 'image-mode) ;;; image-mode.el ends here ------------------------------------------------------------ revno: 117694 committer: martin rudalics branch nick: trunk timestamp: Tue 2014-08-12 11:47:27 +0200 message: In set_menu_bar_lines call change_frame_size instead of set_menu_bar_lines_1. * frame.c (set_menu_bar_lines_1): Remove. (set_menu_bar_lines): Call change_frame_size instead of set_menu_bar_lines_1. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2014-08-11 13:16:31 +0000 +++ src/ChangeLog 2014-08-12 09:47:27 +0000 @@ -1,3 +1,9 @@ +2014-08-12 Martin Rudalics + + * frame.c (set_menu_bar_lines_1): Remove. + (set_menu_bar_lines): Call change_frame_size instead of + set_menu_bar_lines_1. + 2014-08-11 Jan Djärv * nsfns.m (Fx_create_frame): Call adjust_frame_size, === modified file 'src/frame.c' --- src/frame.c 2014-08-10 08:26:28 +0000 +++ src/frame.c 2014-08-12 09:47:27 +0000 @@ -235,29 +235,6 @@ #endif static void -set_menu_bar_lines_1 (Lisp_Object window, int n) -{ - struct window *w = XWINDOW (window); - struct frame *f = XFRAME (WINDOW_FRAME (w)); - - w->top_line += n; - w->pixel_top += n * FRAME_LINE_HEIGHT (f); - w->total_lines -= n; - w->pixel_height -= n * FRAME_LINE_HEIGHT (f); - - /* Handle just the top child in a vertical split. */ - if (WINDOW_VERTICAL_COMBINATION_P (w)) - set_menu_bar_lines_1 (w->contents, n); - else if (WINDOW_HORIZONTAL_COMBINATION_P (w)) - /* Adjust all children in a horizontal split. */ - for (window = w->contents; !NILP (window); window = w->next) - { - w = XWINDOW (window); - set_menu_bar_lines_1 (window, n); - } -} - -static void set_menu_bar_lines (struct frame *f, Lisp_Object value, Lisp_Object oldval) { int nlines; @@ -278,11 +255,11 @@ if (nlines != olines) { windows_or_buffers_changed = 14; - FRAME_WINDOW_SIZES_CHANGED (f) = 1; FRAME_MENU_BAR_LINES (f) = nlines; FRAME_MENU_BAR_HEIGHT (f) = nlines * FRAME_LINE_HEIGHT (f); - set_menu_bar_lines_1 (f->root_window, nlines - olines); - adjust_frame_glyphs (f); + change_frame_size (f, FRAME_COLS (f), + FRAME_LINES (f) + olines - nlines, + 0, 1, 0, 0); } } ------------------------------------------------------------ revno: 117693 fixes bug: http://debbugs.gnu.org/18189 committer: Juri Linkov branch nick: trunk timestamp: Tue 2014-08-12 09:51:21 +0300 message: * lisp/vc/vc-annotate.el (vc-annotate-background-mode): Use `with-demoted-errors' instead of `ignore-errors'. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2014-08-12 02:35:24 +0000 +++ lisp/ChangeLog 2014-08-12 06:51:21 +0000 @@ -1,3 +1,8 @@ +2014-08-12 Juri Linkov + + * vc/vc-annotate.el (vc-annotate-background-mode): + Use `with-demoted-errors' instead of `ignore-errors'. (Bug#18189) + 2014-08-12 Stefan Monnier * files.el (out-of-memory-warning-percentage): Turn it off by default. === modified file 'lisp/vc/vc-annotate.el' --- lisp/vc/vc-annotate.el 2014-08-09 23:55:39 +0000 +++ lisp/vc/vc-annotate.el 2014-08-12 06:51:21 +0000 @@ -57,7 +57,7 @@ :set (lambda (symbol value) (set-default symbol value) (when (boundp 'vc-annotate-color-map) - (ignore-errors + (with-demoted-errors ;; Update the value of the dependent variable. (custom-reevaluate-setting 'vc-annotate-color-map)))) :version "24.5"