From mboxrd@z Thu Jan 1 00:00:00 1970 From: Benjamin Motz Subject: [PATCH 1/2] org-colview.el: Add missing save-excursion for org-colview Date: Sat, 07 Jul 2018 00:15:20 +0200 Message-ID: <874lhc80zr.fsf@gmail.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:39162) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fbZ0g-0004dK-OA for emacs-orgmode@gnu.org; Fri, 06 Jul 2018 18:15:27 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fbZ0f-0000oq-J9 for emacs-orgmode@gnu.org; Fri, 06 Jul 2018 18:15:26 -0400 Received: from mail-wm0-x231.google.com ([2a00:1450:400c:c09::231]:51526) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fbZ0f-0000nI-0r for emacs-orgmode@gnu.org; Fri, 06 Jul 2018 18:15:25 -0400 Received: by mail-wm0-x231.google.com with SMTP id s12-v6so16116226wmc.1 for ; Fri, 06 Jul 2018 15:15:23 -0700 (PDT) Received: from bzuio410 ([2a02:908:df51:3ae0:a09f:4305:27e9:d4e9]) by smtp.gmail.com with ESMTPSA id r140-v6sm18296896wmd.27.2018.07.06.15.15.20 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 06 Jul 2018 15:15:21 -0700 (PDT) List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: "Emacs-orgmode" To: emacs-orgmode@gnu.org --=-=-= Content-Type: text/plain Hello, without this fix, point will jump to beginning of buffer each time the column view is activated. This was annoying to me and I'd consider it a bug. I'm not sure if this is the best way to fix the behaviour... It's a TINYCHANGE when ignoring space-change. --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=0001-org-colview.el-Add-missing-save-excursion-for-org-co.patch Content-Description: patch >From a0bed174852a6c7c6904f44bb649be45669f7b9f Mon Sep 17 00:00:00 2001 From: Benjamin Motz Date: Tue, 3 Jul 2018 19:36:21 +0200 Subject: [PATCH 1/2] org-colview.el: Add missing save-excursion for org-colview Without this fix, point will jump to beginning of buffer each time the column view is activated. TINYCHANGE --- lisp/org-colview.el | 77 +++++++++++++++++++++++++++-------------------------- 1 file changed, 39 insertions(+), 38 deletions(-) diff --git a/lisp/org-colview.el b/lisp/org-colview.el index 82a0ae0..70710aa 100644 --- a/lisp/org-colview.el +++ b/lisp/org-colview.el @@ -807,44 +807,45 @@ view for the whole buffer unconditionally. When COLUMNS-FMT-STRING is non-nil, use it as the column format." (interactive "P") - (org-columns-remove-overlays) - (when global (goto-char (point-min))) - (if (markerp org-columns-begin-marker) - (move-marker org-columns-begin-marker (point)) - (setq org-columns-begin-marker (point-marker))) - (org-columns-goto-top-level) - ;; Initialize `org-columns-current-fmt' and - ;; `org-columns-current-fmt-compiled'. - (let ((org-columns--time (float-time (current-time)))) - (org-columns-get-format columns-fmt-string) - (unless org-columns-inhibit-recalculation (org-columns-compute-all)) - (save-excursion - (save-restriction - (when (and (not global) (org-at-heading-p)) - (narrow-to-region (point) (org-end-of-subtree t t))) - (when (assoc "CLOCKSUM" org-columns-current-fmt-compiled) - (org-clock-sum)) - (when (assoc "CLOCKSUM_T" org-columns-current-fmt-compiled) - (org-clock-sum-today)) - (let ((cache - ;; Collect contents of columns ahead of time so as to - ;; compute their maximum width. - (org-map-entries - (lambda () (cons (point) (org-columns--collect-values))) - nil nil (and org-columns-skip-archived-trees 'archive)))) - (when cache - (org-columns--set-widths cache) - (org-columns--display-here-title) - (when (setq-local org-columns-flyspell-was-active - (bound-and-true-p flyspell-mode)) - (flyspell-mode 0)) - (unless (local-variable-p 'org-colview-initial-truncate-line-value) - (setq-local org-colview-initial-truncate-line-value - truncate-lines)) - (setq truncate-lines t) - (dolist (entry cache) - (goto-char (car entry)) - (org-columns--display-here (cdr entry))))))))) + (save-excursion + (org-columns-remove-overlays) + (when global (goto-char (point-min))) + (if (markerp org-columns-begin-marker) + (move-marker org-columns-begin-marker (point)) + (setq org-columns-begin-marker (point-marker))) + (org-columns-goto-top-level) + ;; Initialize `org-columns-current-fmt' and + ;; `org-columns-current-fmt-compiled'. + (let ((org-columns--time (float-time (current-time)))) + (org-columns-get-format columns-fmt-string) + (unless org-columns-inhibit-recalculation (org-columns-compute-all)) + (save-excursion + (save-restriction + (when (and (not global) (org-at-heading-p)) + (narrow-to-region (point) (org-end-of-subtree t t))) + (when (assoc "CLOCKSUM" org-columns-current-fmt-compiled) + (org-clock-sum)) + (when (assoc "CLOCKSUM_T" org-columns-current-fmt-compiled) + (org-clock-sum-today)) + (let ((cache + ;; Collect contents of columns ahead of time so as to + ;; compute their maximum width. + (org-map-entries + (lambda () (cons (point) (org-columns--collect-values))) + nil nil (and org-columns-skip-archived-trees 'archive)))) + (when cache + (org-columns--set-widths cache) + (org-columns--display-here-title) + (when (setq-local org-columns-flyspell-was-active + (bound-and-true-p flyspell-mode)) + (flyspell-mode 0)) + (unless (local-variable-p 'org-colview-initial-truncate-line-value) + (setq-local org-colview-initial-truncate-line-value + truncate-lines)) + (setq truncate-lines t) + (dolist (entry cache) + (goto-char (car entry)) + (org-columns--display-here (cdr entry)))))))))) (defun org-columns-new (&optional spec &rest attributes) "Insert a new column, to the left of the current column. -- 2.7.4 --=-=-= Content-Type: text/plain Best regards, Benjamin Motz --=-=-=--