Browse Source

Bugfix: Make prefix arg with C-a, C-n work correctly.

The special implementation did not look at prefix arguments.

Reported by Ken Harris.
Carsten Dominik 16 years ago
parent
commit
43f9c50665
2 changed files with 21 additions and 14 deletions
  1. 2 0
      lisp/ChangeLog
  2. 19 14
      lisp/org.el

+ 2 - 0
lisp/ChangeLog

@@ -2,6 +2,8 @@
 
 
 	* org.el (org-show-entry): Make this work correctly also if it is
 	* org.el (org-show-entry): Make this work correctly also if it is
 	the last entry in the file.
 	the last entry in the file.
+	(org-end-of-line, org-beginning-of-line): Make prefix arg work, by
+	falling back to normal, default command.
 
 
 	* org-list.el (org-toggle-checkbox): Make double prefix set the
 	* org-list.el (org-toggle-checkbox): Make double prefix set the
 	checkbox to "[-]".
 	checkbox to "[-]".

+ 19 - 14
lisp/org.el

@@ -4664,8 +4664,6 @@ With numerical argument N, show content up to level N."
 This function is the default value of the hook `org-cycle-hook'."
 This function is the default value of the hook `org-cycle-hook'."
   (when (get-buffer-window (current-buffer))
   (when (get-buffer-window (current-buffer))
     (cond
     (cond
-;     ((eq state 'overview) (org-first-headline-recenter 1))
-;     ((eq state 'overview) (org-beginning-of-line))
      ((eq state 'content)  nil)
      ((eq state 'content)  nil)
      ((eq state 'all)      nil)
      ((eq state 'all)      nil)
      ((eq state 'folded)   nil)
      ((eq state 'folded)   nil)
@@ -4886,7 +4884,7 @@ or nil."
 	      (goto-char org-goto-start-pos)
 	      (goto-char org-goto-start-pos)
 	      (and (org-invisible-p) (org-show-context)))
 	      (and (org-invisible-p) (org-show-context)))
 	  (goto-char (point-min)))
 	  (goto-char (point-min)))
-	(org-beginning-of-line)
+	(let (org-special-ctrl-a/e) (org-beginning-of-line))
 	(message "Select location and press RET")
 	(message "Select location and press RET")
 	(use-local-map org-goto-map)
 	(use-local-map org-goto-map)
 	(recursive-edit)
 	(recursive-edit)
@@ -14953,14 +14951,16 @@ beyond the end of the headline."
   (interactive "P")
   (interactive "P")
   (let ((pos (point)) refpos)
   (let ((pos (point)) refpos)
     (beginning-of-line 1)
     (beginning-of-line 1)
-    (if (bobp)
-	nil
-      (backward-char 1)
-      (if (org-invisible-p)
-	  (while (and (not (bobp)) (org-invisible-p))
-	    (backward-char 1)
-	    (beginning-of-line 1))
-	(forward-char 1)))
+    (if (and arg (fboundp 'move-beginning-of-line))
+	(call-interactively 'move-beginning-of-line)
+      (if (bobp)
+	  nil
+	(backward-char 1)
+	(if (org-invisible-p)
+	    (while (and (not (bobp)) (org-invisible-p))
+	      (backward-char 1)
+	      (beginning-of-line 1))
+	  (forward-char 1))))
     (when org-special-ctrl-a/e
     (when org-special-ctrl-a/e
       (cond
       (cond
        ((and (looking-at org-complex-heading-regexp)
        ((and (looking-at org-complex-heading-regexp)
@@ -14994,8 +14994,11 @@ first attempt, and only move to after the tags when the cursor is already
 beyond the end of the headline."
 beyond the end of the headline."
   (interactive "P")
   (interactive "P")
   (if (or (not org-special-ctrl-a/e)
   (if (or (not org-special-ctrl-a/e)
-	  (not (org-on-heading-p)))
-      (end-of-line arg)
+	  (not (org-on-heading-p))
+	  arg)
+      (call-interactively (if (fboundp 'move-end-of-line)
+			      'move-end-of-line
+			    'end-of-line))
     (let ((pos (point)))
     (let ((pos (point)))
       (beginning-of-line 1)
       (beginning-of-line 1)
       (if (looking-at (org-re ".*?\\([ \t]*\\)\\(:[[:alnum:]_@:]+:\\)[ \t]*$"))
       (if (looking-at (org-re ".*?\\([ \t]*\\)\\(:[[:alnum:]_@:]+:\\)[ \t]*$"))
@@ -15007,7 +15010,9 @@ beyond the end of the headline."
 	    (if (or (< pos (match-end 0)) (not (eq this-command last-command)))
 	    (if (or (< pos (match-end 0)) (not (eq this-command last-command)))
 		(goto-char (match-end 0))
 		(goto-char (match-end 0))
 	      (goto-char (match-beginning 1))))
 	      (goto-char (match-beginning 1))))
-	(end-of-line arg))))
+	(call-interactively (if (fboundp 'move-end-of-line)
+				'move-end-of-line
+			      'end-of-line)))))
   (org-no-warnings
   (org-no-warnings
    (and (featurep 'xemacs) (setq zmacs-region-stays t))))
    (and (featurep 'xemacs) (setq zmacs-region-stays t))))