Function: org-mouse-do-remotely

org-mouse-do-remotely is a byte-compiled function defined in org-mouse.el.gz.

Signature

(org-mouse-do-remotely COMMAND)

Source Code

;; Defined in /usr/src/emacs/lisp/org/org-mouse.el.gz
(defvar org-mouse-cmd) ;dynamically scoped from `org-with-remote-undo'.

(defun org-mouse-do-remotely (command)
  ;;  (org-agenda-check-no-diary)
  (when (get-text-property (point) 'org-marker)
    (let* ((anticol (- (line-end-position) (point)))
	   (marker (get-text-property (point) 'org-marker))
	   (buffer (marker-buffer marker))
	   (pos (marker-position marker))
	   (hdmarker (get-text-property (point) 'org-hd-marker))
	   (buffer-read-only nil)
	   (newhead "--- removed ---")
	   (org-mouse-direct nil)
	   (org-mouse-main-buffer (current-buffer)))
      (when (eq (with-current-buffer buffer major-mode) 'org-mode)
	(let ((endmarker (with-current-buffer buffer
			   (org-end-of-subtree nil t)
			   (unless (eobp) (forward-char 1))
			   (point-marker))))
	  (org-with-remote-undo buffer
	    (with-current-buffer buffer
	      (widen)
	      (goto-char pos)
	      (org-fold-show-hidden-entry)
	      (save-excursion
		(and (outline-next-heading)
		     (org-fold-heading nil)))   ; show the next heading
	      (org-back-to-heading)
	      (setq marker (point-marker))
              (goto-char (max (line-beginning-position) (- (line-end-position) anticol)))
	      (funcall command)
	      (message "_cmd: %S" org-mouse-cmd)
	      (message "this-command: %S" this-command)
	      (unless (eq (marker-position marker) (marker-position endmarker))
		(setq newhead (org-get-heading))))

	    (forward-line 1)
	    (save-excursion
	      (org-agenda-change-all-lines newhead hdmarker 'fixface))))
	t))))