瀏覽代碼

Use setq-local and defvar-local.

* lisp/org-macs.el (org-set-local): Remove.  All callers changed.
* lisp/org-clock.el:
* lisp/org-colview.el:
* lisp/org-macro.el:
* lisp/org-mouse.el:
* lisp/org-table.el:
* lisp/org.el: Use defvar-local.
* lisp/org-agenda.el:
* lisp/org-capture.el:
* lisp/org-crypt.el:
* lisp/org-ctags.el:
* lisp/org-plot.el:
* lisp/org.el:
* lisp/ox-odt.el:
* lisp/ox.el: Use setq-local instead of set + make-local-variable.

Changes in contrib:

* contrib/lisp/org-colview-xemacs.el (org-colview-xemacs-set-local): New
macro. Adjust old callers of `org-set-local'.
Aaron Ecay 9 年之前
父節點
當前提交
07e16c2fc5

+ 19 - 15
contrib/lisp/org-colview-xemacs.el

@@ -33,6 +33,10 @@
 (eval-when-compile (require 'cl))
 (eval-when-compile (require 'cl))
 (require 'org)
 (require 'org)
 
 
+(defsubst org-colview-xemacs-set-local (var value)
+  "Make VAR local in current buffer and set it to VALUE."
+  (set (make-local-variable var) value))
+
 (declare-function org-agenda-redo "org-agenda" ())
 (declare-function org-agenda-redo "org-agenda" ())
 
 
 
 
@@ -445,16 +449,16 @@ This is the compiled version of the format.")
         (let ((ext (make-extent nil nil)))
         (let ((ext (make-extent nil nil)))
           (set-extent-endpoints ext 0 (length title) title)
           (set-extent-endpoints ext 0 (length title) title)
           (set-extent-face ext (list 'bold 'underline 'org-columns-space1))
           (set-extent-face ext (list 'bold 'underline 'org-columns-space1))
-          (org-set-local 'org-previous-header-line-format
-			 (specifier-specs top-gutter))
-          (org-set-local 'org-columns-current-widths (nreverse widths))
+          (org-colview-xemacs-set-local 'org-previous-header-line-format
+					(specifier-specs top-gutter))
+          (org-colview-xemacs-set-local 'org-columns-current-widths (nreverse widths))
           (set-specifier top-gutter (make-gutter-specifier
           (set-specifier top-gutter (make-gutter-specifier
 				     (cons (current-buffer) title))))
 				     (cons (current-buffer) title))))
       (setq title (concat
       (setq title (concat
                    (org-add-props " " nil 'display '(space :align-to 0))
                    (org-add-props " " nil 'display '(space :align-to 0))
                    (org-add-props title nil 'face '(:weight bold :underline t))))
                    (org-add-props title nil 'face '(:weight bold :underline t))))
-      (org-set-local 'org-previous-header-line-format header-line-format)
-      (org-set-local 'org-columns-current-widths (nreverse widths))
+      (org-colview-xemacs-set-local 'org-previous-header-line-format header-line-format)
+      (org-colview-xemacs-set-local 'org-columns-current-widths (nreverse widths))
       (setq org-columns-full-header-line-format title)
       (setq org-columns-full-header-line-format title)
       (setq org-columns-previous-hscroll -1)
       (setq org-columns-previous-hscroll -1)
       (org-add-hook 'post-command-hook 'org-columns-hscoll-title nil 'local))))
       (org-add-hook 'post-command-hook 'org-columns-hscoll-title nil 'local))))
@@ -805,7 +809,7 @@ around it."
     (when (condition-case nil (org-back-to-heading) (error nil))
     (when (condition-case nil (org-back-to-heading) (error nil))
       (setq fmt (org-entry-get nil "COLUMNS" t)))
       (setq fmt (org-entry-get nil "COLUMNS" t)))
     (setq fmt (or fmt org-columns-default-format))
     (setq fmt (or fmt org-columns-default-format))
-    (org-set-local 'org-columns-current-fmt fmt)
+    (org-colview-xemacs-set-local 'org-columns-current-fmt fmt)
     (org-columns-compile-format fmt)
     (org-columns-compile-format fmt)
     (if (marker-position org-entry-property-inherited-from)
     (if (marker-position org-entry-property-inherited-from)
 	(move-marker org-columns-top-level-marker
 	(move-marker org-columns-top-level-marker
@@ -846,12 +850,12 @@ around it."
 	  (push (cons (org-current-line) (org-entry-properties)) cache)))
 	  (push (cons (org-current-line) (org-entry-properties)) cache)))
       (when cache
       (when cache
 	(setq maxwidths (org-columns-get-autowidth-alist fmt cache))
 	(setq maxwidths (org-columns-get-autowidth-alist fmt cache))
-	(org-set-local 'org-columns-current-maxwidths maxwidths)
+	(org-colview-xemacs-set-local 'org-columns-current-maxwidths maxwidths)
 	(org-columns-display-here-title)
 	(org-columns-display-here-title)
 	(unless (local-variable-p 'org-colview-initial-truncate-line-value
 	(unless (local-variable-p 'org-colview-initial-truncate-line-value
 				  (current-buffer))
 				  (current-buffer))
-	  (org-set-local 'org-colview-initial-truncate-line-value
-			 truncate-lines))
+	  (org-colview-xemacs-set-local 'org-colview-initial-truncate-line-value
+					truncate-lines))
 	(setq truncate-lines t)
 	(setq truncate-lines t)
 	(mapc (lambda (x)
 	(mapc (lambda (x)
 		(org-goto-line (car x))
 		(org-goto-line (car x))
@@ -1004,7 +1008,7 @@ This is either in the COLUMNS property of the node starting the current column
 display, or in the #+COLUMNS line of the current buffer."
 display, or in the #+COLUMNS line of the current buffer."
   (let (fmt (cnt 0))
   (let (fmt (cnt 0))
     (setq fmt (org-columns-uncompile-format org-columns-current-fmt-compiled))
     (setq fmt (org-columns-uncompile-format org-columns-current-fmt-compiled))
-    (org-set-local 'org-columns-current-fmt fmt)
+    (org-colview-xemacs-set-local 'org-columns-current-fmt fmt)
     (if (marker-position org-columns-top-level-marker)
     (if (marker-position org-columns-top-level-marker)
 	(save-excursion
 	(save-excursion
 	  (goto-char org-columns-top-level-marker)
 	  (goto-char org-columns-top-level-marker)
@@ -1021,7 +1025,7 @@ display, or in the #+COLUMNS line of the current buffer."
 	      (or (org-at-heading-p t) (outline-next-heading))
 	      (or (org-at-heading-p t) (outline-next-heading))
 	      (let ((inhibit-read-only t))
 	      (let ((inhibit-read-only t))
 		(insert-before-markers "#+COLUMNS: " fmt "\n")))
 		(insert-before-markers "#+COLUMNS: " fmt "\n")))
-	    (org-set-local 'org-columns-default-format fmt))))))
+	    (org-colview-xemacs-set-local 'org-columns-default-format fmt))))))
 
 
 (defvar org-agenda-overriding-columns-format nil
 (defvar org-agenda-overriding-columns-format nil
   "When set, overrides any other format definition for the agenda.
   "When set, overrides any other format definition for the agenda.
@@ -1513,7 +1517,7 @@ and tailing newline characters."
      ((and (boundp 'org-agenda-overriding-columns-format)
      ((and (boundp 'org-agenda-overriding-columns-format)
 	   org-agenda-overriding-columns-format)
 	   org-agenda-overriding-columns-format)
       (setq fmt org-agenda-overriding-columns-format)
       (setq fmt org-agenda-overriding-columns-format)
-      (org-set-local 'org-agenda-overriding-columns-format fmt))
+      (org-colview-xemacs-set-local 'org-agenda-overriding-columns-format fmt))
      ((setq m (org-get-at-bol 'org-hd-marker))
      ((setq m (org-get-at-bol 'org-hd-marker))
       (setq fmt (or (org-entry-get m "COLUMNS" t)
       (setq fmt (or (org-entry-get m "COLUMNS" t)
 		    (with-current-buffer (marker-buffer m)
 		    (with-current-buffer (marker-buffer m)
@@ -1528,7 +1532,7 @@ and tailing newline characters."
 		    (with-current-buffer (marker-buffer m)
 		    (with-current-buffer (marker-buffer m)
 		      org-columns-default-format)))))
 		      org-columns-default-format)))))
     (setq fmt (or fmt org-columns-default-format))
     (setq fmt (or fmt org-columns-default-format))
-    (org-set-local 'org-columns-current-fmt fmt)
+    (org-colview-xemacs-set-local 'org-columns-current-fmt fmt)
     (org-columns-compile-format fmt)
     (org-columns-compile-format fmt)
     (when org-agenda-columns-compute-summary-properties
     (when org-agenda-columns-compute-summary-properties
       (org-agenda-colview-compute org-columns-current-fmt-compiled))
       (org-agenda-colview-compute org-columns-current-fmt-compiled))
@@ -1552,7 +1556,7 @@ and tailing newline characters."
 	(beginning-of-line 2))
 	(beginning-of-line 2))
       (when cache
       (when cache
 	(setq maxwidths (org-columns-get-autowidth-alist fmt cache))
 	(setq maxwidths (org-columns-get-autowidth-alist fmt cache))
-	(org-set-local 'org-columns-current-maxwidths maxwidths)
+	(org-colview-xemacs-set-local 'org-columns-current-maxwidths maxwidths)
 	(org-columns-display-here-title)
 	(org-columns-display-here-title)
 	(mapc (lambda (x)
 	(mapc (lambda (x)
 		(org-goto-line (car x))
 		(org-goto-line (car x))
@@ -1629,7 +1633,7 @@ This will add overlays to the date lines, to show the summary for each day."
 			 (cons prop lsum))))
 			 (cons prop lsum))))
 		     fmt))
 		     fmt))
 	      (org-columns-display-here props)
 	      (org-columns-display-here props)
-	      (org-set-local 'org-agenda-columns-active t)))
+	      (org-colview-xemacs-set-local 'org-agenda-columns-active t)))
 	  (if (bobp) (throw 'exit t))
 	  (if (bobp) (throw 'exit t))
 	  (beginning-of-line 0))))))
 	  (beginning-of-line 0))))))
 
 

+ 1 - 1
contrib/lisp/org-interactive-query.el

@@ -81,7 +81,7 @@ not change the current one."
 	(split-window-vertically)
 	(split-window-vertically)
 	(org-switch-to-buffer-other-window (get-buffer-create " *Org tags*")))
 	(org-switch-to-buffer-other-window (get-buffer-create " *Org tags*")))
       (erase-buffer)
       (erase-buffer)
-      (org-set-local 'org-done-keywords done-keywords)
+      (setq-local org-done-keywords done-keywords)
       (insert "Query:    " current "\n")
       (insert "Query:    " current "\n")
       (org-agenda-query-op-line op)
       (org-agenda-query-op-line op)
       (insert "\n\n")
       (insert "\n\n")

+ 2 - 2
lisp/ob-core.el

@@ -2705,8 +2705,8 @@ block but are passed literally to the \"example-block\"."
 		     (org-babel-trim (buffer-string)))))
 		     (org-babel-trim (buffer-string)))))
 	 index source-name evaluate prefix)
 	 index source-name evaluate prefix)
     (with-temp-buffer
     (with-temp-buffer
-      (org-set-local 'org-babel-noweb-wrap-start ob-nww-start)
-      (org-set-local 'org-babel-noweb-wrap-end ob-nww-end)
+      (setq-local org-babel-noweb-wrap-start ob-nww-start)
+      (setq-local org-babel-noweb-wrap-end ob-nww-end)
       (insert body) (goto-char (point-min))
       (insert body) (goto-char (point-min))
       (setq index (point))
       (setq index (point))
       (while (and (re-search-forward (org-babel-noweb-wrap) nil t))
       (while (and (re-search-forward (org-babel-noweb-wrap) nil t))

+ 16 - 15
lisp/org-agenda.el

@@ -2137,28 +2137,28 @@ The following commands are available:
 	       (when (and val
 	       (when (and val
 			  (member var org-agenda-local-vars))
 			  (member var org-agenda-local-vars))
 		 (set var val)))))
 		 (set var val)))))
-	 (set (make-local-variable 'org-agenda-this-buffer-is-sticky) t))
+	 (setq-local org-agenda-this-buffer-is-sticky t))
 	(org-agenda-sticky
 	(org-agenda-sticky
 	 ;; Creating a sticky Agenda buffer for the first time
 	 ;; Creating a sticky Agenda buffer for the first time
 	 (kill-all-local-variables)
 	 (kill-all-local-variables)
 	 (mapc 'make-local-variable org-agenda-local-vars)
 	 (mapc 'make-local-variable org-agenda-local-vars)
-	 (set (make-local-variable 'org-agenda-this-buffer-is-sticky) t))
+	 (setq-local org-agenda-this-buffer-is-sticky t))
 	(t
 	(t
 	 ;; Creating a non-sticky agenda buffer
 	 ;; Creating a non-sticky agenda buffer
 	 (kill-all-local-variables)
 	 (kill-all-local-variables)
-	 (set (make-local-variable 'org-agenda-this-buffer-is-sticky) nil)))
+	 (setq-local org-agenda-this-buffer-is-sticky nil)))
   (setq org-agenda-undo-list nil
   (setq org-agenda-undo-list nil
 	org-agenda-pending-undo-list nil
 	org-agenda-pending-undo-list nil
 	org-agenda-bulk-marked-entries nil)
 	org-agenda-bulk-marked-entries nil)
   (setq major-mode 'org-agenda-mode)
   (setq major-mode 'org-agenda-mode)
   ;; Keep global-font-lock-mode from turning on font-lock-mode
   ;; Keep global-font-lock-mode from turning on font-lock-mode
-  (org-set-local 'font-lock-global-modes (list 'not major-mode))
+  (setq-local font-lock-global-modes (list 'not major-mode))
   (setq mode-name "Org-Agenda")
   (setq mode-name "Org-Agenda")
   (setq indent-tabs-mode nil)
   (setq indent-tabs-mode nil)
   (use-local-map org-agenda-mode-map)
   (use-local-map org-agenda-mode-map)
   (easy-menu-add org-agenda-menu)
   (easy-menu-add org-agenda-menu)
   (if org-startup-truncated (setq truncate-lines t))
   (if org-startup-truncated (setq truncate-lines t))
-  (org-set-local 'line-move-visual nil)
+  (setq-local line-move-visual nil)
   (org-add-hook 'post-command-hook 'org-agenda-update-agenda-type nil 'local)
   (org-add-hook 'post-command-hook 'org-agenda-update-agenda-type nil 'local)
   (org-add-hook 'pre-command-hook 'org-unhighlight nil 'local)
   (org-add-hook 'pre-command-hook 'org-unhighlight nil 'local)
   ;; Make sure properties are removed when copying text
   ;; Make sure properties are removed when copying text
@@ -3703,7 +3703,7 @@ FILTER-ALIST is an alist of filters we need to apply when
 	(setq org-agenda-last-prefix-arg current-prefix-arg)
 	(setq org-agenda-last-prefix-arg current-prefix-arg)
 	(setq org-agenda-this-buffer-name org-agenda-buffer-name)
 	(setq org-agenda-this-buffer-name org-agenda-buffer-name)
 	(and name (not org-agenda-name)
 	(and name (not org-agenda-name)
-	     (org-set-local 'org-agenda-name name)))
+	     (setq-local org-agenda-name name)))
       (setq buffer-read-only nil))))
       (setq buffer-read-only nil))))
 
 
 (defvar org-agenda-overriding-columns-format)  ; From org-colview.el
 (defvar org-agenda-overriding-columns-format)  ; From org-colview.el
@@ -3727,8 +3727,8 @@ FILTER-ALIST is an alist of filters we need to apply when
 	  (remove-text-properties (point-min) (point-max) '(face nil)))
 	  (remove-text-properties (point-min) (point-max) '(face nil)))
 	(if (and (boundp 'org-agenda-overriding-columns-format)
 	(if (and (boundp 'org-agenda-overriding-columns-format)
 		 org-agenda-overriding-columns-format)
 		 org-agenda-overriding-columns-format)
-	    (org-set-local 'org-agenda-overriding-columns-format
-			   org-agenda-overriding-columns-format))
+	    (setq-local org-agenda-overriding-columns-format
+			org-agenda-overriding-columns-format))
 	(if (and (boundp 'org-agenda-view-columns-initially)
 	(if (and (boundp 'org-agenda-view-columns-initially)
 		 org-agenda-view-columns-initially)
 		 org-agenda-view-columns-initially)
 	    (org-agenda-columns))
 	    (org-agenda-columns))
@@ -4243,9 +4243,9 @@ items if they have an hour specification like [h]h:mm."
       (setq day-numbers (nreverse day-numbers))
       (setq day-numbers (nreverse day-numbers))
       (setq clocktable-start (car day-numbers)
       (setq clocktable-start (car day-numbers)
 	    clocktable-end (1+ (or (org-last day-numbers) 0)))
 	    clocktable-end (1+ (or (org-last day-numbers) 0)))
-      (org-set-local 'org-starting-day (car day-numbers))
-      (org-set-local 'org-arg-loc arg)
-      (org-set-local 'org-agenda-current-span (org-agenda-ndays-to-span span))
+      (setq-local org-starting-day (car day-numbers))
+      (setq-local org-arg-loc arg)
+      (setq-local org-agenda-current-span (org-agenda-ndays-to-span span))
       (unless org-agenda-compact-blocks
       (unless org-agenda-compact-blocks
 	(let* ((d1 (car day-numbers))
 	(let* ((d1 (car day-numbers))
 	       (d2 (org-last day-numbers))
 	       (d2 (org-last day-numbers))
@@ -7525,8 +7525,8 @@ to switch between filtering and excluding."
 	      ((eq char ?+) (setq exclude nil)))))
 	      ((eq char ?+) (setq exclude nil)))))
     (when (eq char ?\t)
     (when (eq char ?\t)
       (unless (local-variable-p 'org-global-tags-completion-table (current-buffer))
       (unless (local-variable-p 'org-global-tags-completion-table (current-buffer))
-	(org-set-local 'org-global-tags-completion-table
-		       (org-global-tags-completion-table)))
+	(setq-local org-global-tags-completion-table
+		    (org-global-tags-completion-table)))
       (let ((completion-ignore-case t))
       (let ((completion-ignore-case t))
 	(setq tag (org-icompleting-read
 	(setq tag (org-icompleting-read
 		   "Tag: " org-global-tags-completion-table))))
 		   "Tag: " org-global-tags-completion-table))))
@@ -8621,8 +8621,9 @@ It also looks at the text of the entry itself."
   "Get a variable from a referenced buffer and install it here."
   "Get a variable from a referenced buffer and install it here."
   (let ((m (org-get-at-bol 'org-marker)))
   (let ((m (org-get-at-bol 'org-marker)))
     (when (and m (buffer-live-p (marker-buffer m)))
     (when (and m (buffer-live-p (marker-buffer m)))
-      (org-set-local var (with-current-buffer (marker-buffer m)
-			   (symbol-value var))))))
+      (set (make-local-variable var)
+	   (with-current-buffer (marker-buffer m)
+	     (symbol-value var))))))
 
 
 (defun org-agenda-switch-to (&optional delete-other-windows)
 (defun org-agenda-switch-to (&optional delete-other-windows)
   "Go to the Org mode file which contains the item at point.
   "Go to the Org mode file which contains the item at point.

+ 7 - 8
lisp/org-capture.el

@@ -433,8 +433,8 @@ for a capture buffer.")
 
 
 Turning on this mode runs the normal hook `org-capture-mode-hook'."
 Turning on this mode runs the normal hook `org-capture-mode-hook'."
   nil " Rem" org-capture-mode-map
   nil " Rem" org-capture-mode-map
-  (org-set-local
-   'header-line-format
+  (setq-local
+   header-line-format
    (substitute-command-keys
    (substitute-command-keys
     "\\<org-capture-mode-map>Capture buffer.  Finish \\[org-capture-finalize], \
     "\\<org-capture-mode-map>Capture buffer.  Finish \\[org-capture-finalize], \
 refile \\[org-capture-refile], abort \\[org-capture-kill].")))
 refile \\[org-capture-refile], abort \\[org-capture-kill].")))
@@ -615,7 +615,7 @@ of the day at point (if any) or the current HH:MM time."
 			(org-capture-put :interrupted-clock
 			(org-capture-put :interrupted-clock
 					 (copy-marker org-clock-marker)))
 					 (copy-marker org-clock-marker)))
 		    (org-clock-in)
 		    (org-clock-in)
-		    (org-set-local 'org-capture-clock-was-started t))
+		    (setq-local org-capture-clock-was-started t))
 		(error
 		(error
 		 "Could not start the clock in this capture buffer")))
 		 "Could not start the clock in this capture buffer")))
 	  (if (org-capture-get :immediate-finish)
 	  (if (org-capture-get :immediate-finish)
@@ -996,7 +996,7 @@ a string, return it.  However, if it is the empty string, return
 (defun org-capture-steal-local-variables (buffer)
 (defun org-capture-steal-local-variables (buffer)
   "Install Org-mode local variables of BUFFER."
   "Install Org-mode local variables of BUFFER."
   (mapc (lambda (v)
   (mapc (lambda (v)
-	  (ignore-errors (org-set-local (car v) (cdr v))))
+	  (ignore-errors (set (make-local-variable (car v)) (cdr v))))
 	(buffer-local-variables buffer)))
 	(buffer-local-variables buffer)))
 
 
 (defun org-capture-place-template (&optional inhibit-wconf-store)
 (defun org-capture-place-template (&optional inhibit-wconf-store)
@@ -1011,9 +1011,8 @@ may have been stored before."
   (widen)
   (widen)
   (outline-show-all)
   (outline-show-all)
   (goto-char (org-capture-get :pos))
   (goto-char (org-capture-get :pos))
-  (org-set-local 'org-capture-target-marker
-		 (point-marker))
-  (org-set-local 'outline-level 'org-outline-level)
+  (setq-local org-capture-target-marker (point-marker))
+  (setq-local outline-level 'org-outline-level)
   (let* ((template (org-capture-get :template))
   (let* ((template (org-capture-get :template))
 	 (type (org-capture-get :type)))
 	 (type (org-capture-get :type)))
     (case type
     (case type
@@ -1023,7 +1022,7 @@ may have been stored before."
       (item (org-capture-place-item))
       (item (org-capture-place-item))
       (checkitem (org-capture-place-item))))
       (checkitem (org-capture-place-item))))
   (org-capture-mode 1)
   (org-capture-mode 1)
-  (org-set-local 'org-capture-current-plist org-capture-plist))
+  (setq-local org-capture-current-plist org-capture-plist))
 
 
 (defun org-capture-place-entry ()
 (defun org-capture-place-entry ()
   "Place the template as a new Org entry."
   "Place the template as a new Org entry."

+ 2 - 4
lisp/org-clock.el

@@ -1769,9 +1769,8 @@ With prefix arg SELECT, offer recently clocked tasks for selection."
 	(message "No running clock, this is the most recently clocked task"))
 	(message "No running clock, this is the most recently clocked task"))
     (run-hooks 'org-clock-goto-hook)))
     (run-hooks 'org-clock-goto-hook)))
 
 
-(defvar org-clock-file-total-minutes nil
+(defvar-local org-clock-file-total-minutes nil
   "Holds the file total time in minutes, after a call to `org-clock-sum'.")
   "Holds the file total time in minutes, after a call to `org-clock-sum'.")
-(make-variable-buffer-local 'org-clock-file-total-minutes)
 
 
 (defun org-clock-sum-today (&optional headline-filter)
 (defun org-clock-sum-today (&optional headline-filter)
   "Sum the times for each subtree for today."
   "Sum the times for each subtree for today."
@@ -1943,8 +1942,7 @@ Use \\[org-clock-remove-overlays] to remove the subtree times."
 		     " (%d hours and %d minutes)")
 		     " (%d hours and %d minutes)")
 	     h m)))
 	     h m)))
 
 
-(defvar org-clock-overlays nil)
-(make-variable-buffer-local 'org-clock-overlays)
+(defvar-local org-clock-overlays nil)
 
 
 (defun org-clock-put-overlay (time)
 (defun org-clock-put-overlay (time)
   "Put an overlays on the current line, displaying TIME.
   "Put an overlays on the current line, displaying TIME.

+ 16 - 20
lisp/org-colview.el

@@ -45,19 +45,15 @@
 
 
 (defvar org-columns-time)
 (defvar org-columns-time)
 
 
-(defvar org-columns-current-fmt nil
+(defvar-local org-columns-current-fmt nil
   "Local variable, holds the currently active column format.")
   "Local variable, holds the currently active column format.")
-(make-variable-buffer-local 'org-columns-current-fmt)
-(defvar org-columns-current-fmt-compiled nil
+(defvar-local org-columns-current-fmt-compiled nil
   "Local variable, holds the currently active column format.
   "Local variable, holds the currently active column format.
 This is the compiled version of the format.")
 This is the compiled version of the format.")
-(make-variable-buffer-local 'org-columns-current-fmt-compiled)
-(defvar org-columns-current-widths nil
+(defvar-local org-columns-current-widths nil
   "Loval variable, holds the currently widths of fields.")
   "Loval variable, holds the currently widths of fields.")
-(make-variable-buffer-local 'org-columns-current-widths)
-(defvar org-columns-current-maxwidths nil
+(defvar-local org-columns-current-maxwidths nil
   "Loval variable, holds the currently active maximum column widths.")
   "Loval variable, holds the currently active maximum column widths.")
-(make-variable-buffer-local 'org-columns-current-maxwidths)
 (defvar org-columns-begin-marker (make-marker)
 (defvar org-columns-begin-marker (make-marker)
   "Points to the position where last a column creation command was called.")
   "Points to the position where last a column creation command was called.")
 (defvar org-columns-top-level-marker (make-marker)
 (defvar org-columns-top-level-marker (make-marker)
@@ -317,8 +313,8 @@ for the duration of the command.")
 		 (org-add-props " " nil 'display '(space :align-to 0))
 		 (org-add-props " " nil 'display '(space :align-to 0))
 		 ;;(org-add-props title nil 'face '(:weight bold :underline t :inherit default))))
 		 ;;(org-add-props title nil 'face '(:weight bold :underline t :inherit default))))
 		 (org-add-props title nil 'face 'org-column-title)))
 		 (org-add-props title nil 'face 'org-column-title)))
-    (org-set-local 'org-previous-header-line-format header-line-format)
-    (org-set-local 'org-columns-current-widths (nreverse widths))
+    (setq-local org-previous-header-line-format header-line-format)
+    (setq-local org-columns-current-widths (nreverse widths))
     (setq org-columns-full-header-line-format title)
     (setq org-columns-full-header-line-format title)
     (setq org-columns-previous-hscroll -1)
     (setq org-columns-previous-hscroll -1)
 					;    (org-columns-hscoll-title)
 					;    (org-columns-hscoll-title)
@@ -677,7 +673,7 @@ around it."
     (when (condition-case nil (org-back-to-heading) (error nil))
     (when (condition-case nil (org-back-to-heading) (error nil))
       (setq fmt-as-property (org-entry-get nil "COLUMNS" t)))
       (setq fmt-as-property (org-entry-get nil "COLUMNS" t)))
     (setq fmt (or fmt-string fmt-as-property org-columns-default-format))
     (setq fmt (or fmt-string fmt-as-property org-columns-default-format))
-    (org-set-local 'org-columns-current-fmt fmt)
+    (setq-local org-columns-current-fmt fmt)
     (org-columns-compile-format fmt)
     (org-columns-compile-format fmt)
     fmt))
     fmt))
 
 
@@ -724,16 +720,16 @@ When COLUMNS-FMT-STRING is non-nil, use it as the column format."
 			       column-names)))
 			       column-names)))
 	       nil nil (and org-columns-skip-archived-trees 'archive))))
 	       nil nil (and org-columns-skip-archived-trees 'archive))))
 	(when cache
 	(when cache
-	  (org-set-local 'org-columns-current-maxwidths
+	  (setq-local org-columns-current-maxwidths
 			 (org-columns-get-autowidth-alist
 			 (org-columns-get-autowidth-alist
 			  org-columns-current-fmt
 			  org-columns-current-fmt
 			  cache))
 			  cache))
 	  (org-columns-display-here-title)
 	  (org-columns-display-here-title)
-	  (when (org-set-local 'org-columns-flyspell-was-active
+	  (when (setq-local org-columns-flyspell-was-active
 			       (org-bound-and-true-p flyspell-mode))
 			       (org-bound-and-true-p flyspell-mode))
 	    (flyspell-mode 0))
 	    (flyspell-mode 0))
 	  (unless (local-variable-p 'org-colview-initial-truncate-line-value)
 	  (unless (local-variable-p 'org-colview-initial-truncate-line-value)
-	    (org-set-local 'org-colview-initial-truncate-line-value
+	    (setq-local org-colview-initial-truncate-line-value
 			   truncate-lines))
 			   truncate-lines))
 	  (setq truncate-lines t)
 	  (setq truncate-lines t)
 	  (dolist (x cache)
 	  (dolist (x cache)
@@ -883,7 +879,7 @@ This is either in the COLUMNS property of the node starting the current column
 display, or in the #+COLUMNS line of the current buffer."
 display, or in the #+COLUMNS line of the current buffer."
   (let (fmt (cnt 0))
   (let (fmt (cnt 0))
     (setq fmt (org-columns-uncompile-format org-columns-current-fmt-compiled))
     (setq fmt (org-columns-uncompile-format org-columns-current-fmt-compiled))
-    (org-set-local 'org-columns-current-fmt fmt)
+    (setq-local org-columns-current-fmt fmt)
     (if (marker-position org-columns-top-level-marker)
     (if (marker-position org-columns-top-level-marker)
 	(save-excursion
 	(save-excursion
 	  (goto-char org-columns-top-level-marker)
 	  (goto-char org-columns-top-level-marker)
@@ -900,7 +896,7 @@ display, or in the #+COLUMNS line of the current buffer."
 	      (or (org-at-heading-p t) (outline-next-heading))
 	      (or (org-at-heading-p t) (outline-next-heading))
 	      (let ((inhibit-read-only t))
 	      (let ((inhibit-read-only t))
 		(insert-before-markers "#+COLUMNS: " fmt "\n")))
 		(insert-before-markers "#+COLUMNS: " fmt "\n")))
-	    (org-set-local 'org-columns-default-format fmt))))))
+	    (setq-local org-columns-default-format fmt))))))
 
 
 (defun org-columns-get-autowidth-alist (s cache)
 (defun org-columns-get-autowidth-alist (s cache)
   "Derive the maximum column widths from the format and the cache."
   "Derive the maximum column widths from the format and the cache."
@@ -1396,7 +1392,7 @@ and tailing newline characters."
 			(with-current-buffer (marker-buffer m)
 			(with-current-buffer (marker-buffer m)
 			  org-columns-default-format))))))
 			  org-columns-default-format))))))
 	  (t org-columns-default-format))))
 	  (t org-columns-default-format))))
-    (org-set-local 'org-columns-current-fmt fmt)
+    (setq-local org-columns-current-fmt fmt)
     (org-columns-compile-format fmt)
     (org-columns-compile-format fmt)
     (when org-agenda-columns-compute-summary-properties
     (when org-agenda-columns-compute-summary-properties
       (org-agenda-colview-compute org-columns-current-fmt-compiled))
       (org-agenda-colview-compute org-columns-current-fmt-compiled))
@@ -1435,10 +1431,10 @@ and tailing newline characters."
 	       cache))
 	       cache))
 	    (forward-line)))
 	    (forward-line)))
 	(when cache
 	(when cache
-	  (org-set-local 'org-columns-current-maxwidths
+	  (setq-local org-columns-current-maxwidths
 			 (org-columns-get-autowidth-alist fmt cache))
 			 (org-columns-get-autowidth-alist fmt cache))
 	  (org-columns-display-here-title)
 	  (org-columns-display-here-title)
-	  (when (org-set-local 'org-columns-flyspell-was-active
+	  (when (setq-local org-columns-flyspell-was-active
 			       (org-bound-and-true-p flyspell-mode))
 			       (org-bound-and-true-p flyspell-mode))
 	    (flyspell-mode 0))
 	    (flyspell-mode 0))
 	  (dolist (x cache)
 	  (dolist (x cache)
@@ -1517,7 +1513,7 @@ This will add overlays to the date lines, to show the summary for each day."
 			 (cons prop lsum))))
 			 (cons prop lsum))))
 		     fmt))
 		     fmt))
 	      (org-columns-display-here props 'dateline)
 	      (org-columns-display-here props 'dateline)
-	      (org-set-local 'org-agenda-columns-active t)))
+	      (setq-local org-agenda-columns-active t)))
 	  (if (bobp) (throw 'exit t))
 	  (if (bobp) (throw 'exit t))
 	  (beginning-of-line 0))))))
 	  (beginning-of-line 0))))))
 
 

+ 3 - 3
lisp/org-crypt.el

@@ -164,7 +164,7 @@ See `org-crypt-disable-auto-save'."
   (if (and (string= crypt-key (get-text-property 0 'org-crypt-key str))
   (if (and (string= crypt-key (get-text-property 0 'org-crypt-key str))
 	   (string= (sha1 str) (get-text-property 0 'org-crypt-checksum str)))
 	   (string= (sha1 str) (get-text-property 0 'org-crypt-checksum str)))
       (get-text-property 0 'org-crypt-text str)
       (get-text-property 0 'org-crypt-text str)
-    (set (make-local-variable 'epg-context) (epg-make-context nil t t))
+    (setq-local epg-context (epg-make-context nil t t))
     (epg-encrypt-string epg-context str (epg-list-keys epg-context crypt-key))))
     (epg-encrypt-string epg-context str (epg-list-keys epg-context crypt-key))))
 
 
 (defun org-encrypt-entry ()
 (defun org-encrypt-entry ()
@@ -173,7 +173,7 @@ See `org-crypt-disable-auto-save'."
   (require 'epg)
   (require 'epg)
   (save-excursion
   (save-excursion
     (org-back-to-heading t)
     (org-back-to-heading t)
-    (set (make-local-variable 'epg-context) (epg-make-context nil t t))
+    (setq-local epg-context (epg-make-context nil t t))
     (let ((start-heading (point)))
     (let ((start-heading (point)))
       (forward-line)
       (forward-line)
       (when (not (looking-at "-----BEGIN PGP MESSAGE-----"))
       (when (not (looking-at "-----BEGIN PGP MESSAGE-----"))
@@ -209,7 +209,7 @@ See `org-crypt-disable-auto-save'."
 	(forward-line)
 	(forward-line)
 	(when (looking-at "-----BEGIN PGP MESSAGE-----")
 	(when (looking-at "-----BEGIN PGP MESSAGE-----")
 	  (org-crypt-check-auto-save)
 	  (org-crypt-check-auto-save)
-          (set (make-local-variable 'epg-context) (epg-make-context nil t t))
+          (setq-local epg-context (epg-make-context nil t t))
 	  (let* ((end (save-excursion
 	  (let* ((end (save-excursion
 			(search-forward "-----END PGP MESSAGE-----")
 			(search-forward "-----END PGP MESSAGE-----")
 			(forward-line)
 			(forward-line)

+ 4 - 4
lisp/org-ctags.el

@@ -210,8 +210,8 @@ The following patterns are replaced in the string:
 
 
 (defadvice visit-tags-table (after org-ctags-load-tag-list activate compile)
 (defadvice visit-tags-table (after org-ctags-load-tag-list activate compile)
   (when (and org-ctags-enabled-p tags-file-name)
   (when (and org-ctags-enabled-p tags-file-name)
-    (set (make-local-variable 'org-ctags-tag-list)
-         (org-ctags-all-tags-in-current-tags-table))))
+    (setq-local org-ctags-tag-list
+		(org-ctags-all-tags-in-current-tags-table))))
 
 
 
 
 (defun org-ctags-enable ()
 (defun org-ctags-enable ()
@@ -499,8 +499,8 @@ its subdirectories contain large numbers of taggable files."
                      (expand-file-name (concat dir-name "/*")))))
                      (expand-file-name (concat dir-name "/*")))))
       (cond
       (cond
        ((eql 0 exitcode)
        ((eql 0 exitcode)
-        (set (make-local-variable 'org-ctags-tag-list)
-             (org-ctags-all-tags-in-current-tags-table)))
+        (setq-local org-ctags-tag-list
+		    (org-ctags-all-tags-in-current-tags-table)))
        (t
        (t
         ;; This seems to behave differently on Linux, so just ignore
         ;; This seems to behave differently on Linux, so just ignore
         ;; error codes for now
         ;; error codes for now

+ 3 - 3
lisp/org-datetree.el

@@ -54,14 +54,14 @@ Added time stamp is active unless value is `inactive'."
 If KEEP-RESTRICTION is non-nil, do not widen the buffer.
 If KEEP-RESTRICTION is non-nil, do not widen the buffer.
 When it is nil, the buffer will be widened to make sure an existing date
 When it is nil, the buffer will be widened to make sure an existing date
 tree can be found."
 tree can be found."
-  (org-set-local 'org-datetree-base-level 1)
+  (setq-local org-datetree-base-level 1)
   (or keep-restriction (widen))
   (or keep-restriction (widen))
   (save-restriction
   (save-restriction
     (let ((prop (org-find-property "DATE_TREE")))
     (let ((prop (org-find-property "DATE_TREE")))
       (when prop
       (when prop
 	(goto-char prop)
 	(goto-char prop)
-	(org-set-local 'org-datetree-base-level
-		       (org-get-valid-level (org-current-level) 1))
+	(setq-local org-datetree-base-level
+		    (org-get-valid-level (org-current-level) 1))
 	(org-narrow-to-subtree)))
 	(org-narrow-to-subtree)))
     (goto-char (point-min))
     (goto-char (point-min))
     (let ((year (nth 2 date))
     (let ((year (nth 2 date))

+ 8 - 8
lisp/org-element.el

@@ -3964,7 +3964,7 @@ If STRING is the empty string or nil, return nil."
 	  (dolist (v local-variables)
 	  (dolist (v local-variables)
 	    (ignore-errors
 	    (ignore-errors
 	      (if (symbolp v) (makunbound v)
 	      (if (symbolp v) (makunbound v)
-		(org-set-local (car v) (cdr v)))))
+		(set (make-local-variable (car v)) (cdr v)))))
 	  (insert string)
 	  (insert string)
 	  (restore-buffer-modified-p nil)
 	  (restore-buffer-modified-p nil)
 	  (let ((data (org-element--parse-objects
 	  (let ((data (org-element--parse-objects
@@ -5591,14 +5591,14 @@ buffers."
     (with-current-buffer buffer
     (with-current-buffer buffer
       (when (and org-element-use-cache
       (when (and org-element-use-cache
 		 (or (derived-mode-p 'org-mode) orgstruct-mode))
 		 (or (derived-mode-p 'org-mode) orgstruct-mode))
-	(org-set-local 'org-element--cache
-		       (avl-tree-create #'org-element--cache-compare))
-	(org-set-local 'org-element--cache-objects (make-hash-table :test #'eq))
-	(org-set-local 'org-element--cache-sync-keys
+	(setq-local org-element--cache
+		    (avl-tree-create #'org-element--cache-compare))
+	(setq-local org-element--cache-objects (make-hash-table :test #'eq))
+	(setq-local org-element--cache-sync-keys
 		       (make-hash-table :weakness 'key :test #'eq))
 		       (make-hash-table :weakness 'key :test #'eq))
-	(org-set-local 'org-element--cache-change-warning nil)
-	(org-set-local 'org-element--cache-sync-requests nil)
-	(org-set-local 'org-element--cache-sync-timer nil)
+	(setq-local org-element--cache-change-warning nil)
+	(setq-local org-element--cache-sync-requests nil)
+	(setq-local org-element--cache-sync-timer nil)
 	(add-hook 'before-change-functions
 	(add-hook 'before-change-functions
 		  #'org-element--cache-before-change nil t)
 		  #'org-element--cache-before-change nil t)
 	(add-hook 'after-change-functions
 	(add-hook 'after-change-functions

+ 8 - 8
lisp/org-indent.el

@@ -138,14 +138,14 @@ during idle time."
     (setq org-indent-mode nil))
     (setq org-indent-mode nil))
    (org-indent-mode
    (org-indent-mode
     ;; mode was turned on.
     ;; mode was turned on.
-    (org-set-local 'indent-tabs-mode nil)
-    (org-set-local 'org-indent-initial-marker (copy-marker 1))
+    (setq-local indent-tabs-mode nil)
+    (setq-local org-indent-initial-marker (copy-marker 1))
     (when org-indent-mode-turns-off-org-adapt-indentation
     (when org-indent-mode-turns-off-org-adapt-indentation
-      (org-set-local 'org-adapt-indentation nil))
+      (setq-local org-adapt-indentation nil))
     (when org-indent-mode-turns-on-hiding-stars
     (when org-indent-mode-turns-on-hiding-stars
-      (org-set-local 'org-hide-leading-stars-before-indent-mode
-		     org-hide-leading-stars)
-      (org-set-local 'org-hide-leading-stars t))
+      (setq-local org-hide-leading-stars-before-indent-mode
+		  org-hide-leading-stars)
+      (setq-local org-hide-leading-stars t))
     (org-add-hook 'filter-buffer-substring-functions
     (org-add-hook 'filter-buffer-substring-functions
 		  (lambda (fun start end delete)
 		  (lambda (fun start end delete)
 		    (org-indent-remove-properties-from-string
 		    (org-indent-remove-properties-from-string
@@ -172,8 +172,8 @@ during idle time."
     (when (markerp org-indent-initial-marker)
     (when (markerp org-indent-initial-marker)
       (set-marker org-indent-initial-marker nil))
       (set-marker org-indent-initial-marker nil))
     (when (boundp 'org-hide-leading-stars-before-indent-mode)
     (when (boundp 'org-hide-leading-stars-before-indent-mode)
-      (org-set-local 'org-hide-leading-stars
-		     org-hide-leading-stars-before-indent-mode))
+      (setq-local org-hide-leading-stars
+		  org-hide-leading-stars-before-indent-mode))
     (remove-hook 'filter-buffer-substring-functions
     (remove-hook 'filter-buffer-substring-functions
 		 (lambda (fun start end delete)
 		 (lambda (fun start end delete)
 		   (org-indent-remove-properties-from-string
 		   (org-indent-remove-properties-from-string

+ 1 - 3
lisp/org-macro.el

@@ -62,7 +62,7 @@
 
 
 ;;; Variables
 ;;; Variables
 
 
-(defvar org-macro-templates nil
+(defvar-local org-macro-templates nil
   "Alist containing all macro templates in current buffer.
   "Alist containing all macro templates in current buffer.
 Associations are in the shape of (NAME . TEMPLATE) where NAME
 Associations are in the shape of (NAME . TEMPLATE) where NAME
 stands for macro's name and template for its replacement value,
 stands for macro's name and template for its replacement value,
@@ -70,8 +70,6 @@ both as strings.  This is an internal variable.  Do not set it
 directly, use instead:
 directly, use instead:
 
 
   #+MACRO: name template")
   #+MACRO: name template")
-(make-variable-buffer-local 'org-macro-templates)
-
 
 
 ;;; Functions
 ;;; Functions
 
 

+ 0 - 4
lisp/org-macs.el

@@ -242,10 +242,6 @@ Some ops with invisible text do not work correctly on Emacs 21.  For these
 we turn off invisibility temporarily.  Use this in a `let' form."
 we turn off invisibility temporarily.  Use this in a `let' form."
   (if (< emacs-major-version 22) nil buffer-invisibility-spec))
   (if (< emacs-major-version 22) nil buffer-invisibility-spec))
 
 
-(defsubst org-set-local (var value)
-  "Make VAR local in current buffer and set it to VALUE."
-  (set (make-local-variable var) value))
-
 (defsubst org-last (list)
 (defsubst org-last (list)
   "Return the last element of LIST."
   "Return the last element of LIST."
   (car (last list)))
   (car (last list)))

+ 1 - 2
lisp/org-mouse.el

@@ -195,11 +195,10 @@ Changing this variable requires a restart of Emacs to get activated."
     (skip-chars-backward ":A-Za-z")
     (skip-chars-backward ":A-Za-z")
     (skip-chars-backward "\t ")))
     (skip-chars-backward "\t ")))
 
 
-(defvar org-mouse-context-menu-function nil
+(defvar-local org-mouse-context-menu-function nil
   "Function to create the context menu.
   "Function to create the context menu.
 The value of this variable is the function invoked by
 The value of this variable is the function invoked by
 `org-mouse-context-menu' as the context menu.")
 `org-mouse-context-menu' as the context menu.")
-(make-variable-buffer-local 'org-mouse-context-menu-function)
 
 
 (defun org-mouse-show-context-menu (event prefix)
 (defun org-mouse-show-context-menu (event prefix)
   "Invoke the context menu.
   "Invoke the context menu.

+ 3 - 4
lisp/org-plot.el

@@ -119,10 +119,9 @@ will be added.  Returns the resulting property list."
 Pass PARAMS through to `orgtbl-to-generic' when exporting TABLE."
 Pass PARAMS through to `orgtbl-to-generic' when exporting TABLE."
   (with-temp-file
   (with-temp-file
       data-file
       data-file
-    (make-local-variable 'org-plot-timestamp-fmt)
-    (setq org-plot-timestamp-fmt (or
-				  (plist-get params :timefmt)
-				  "%Y-%m-%d-%H:%M:%S"))
+    (setq-local org-plot-timestamp-fmt (or
+					(plist-get params :timefmt)
+					"%Y-%m-%d-%H:%M:%S"))
     (insert (orgtbl-to-generic
     (insert (orgtbl-to-generic
 	     table
 	     table
 	     (org-combine-plists
 	     (org-combine-plists

+ 14 - 14
lisp/org-src.el

@@ -448,14 +448,14 @@ Leave point in edit buffer."
 	;; Transmit buffer-local variables for exit function.  It must
 	;; Transmit buffer-local variables for exit function.  It must
 	;; be done after initializing major mode, as this operation
 	;; be done after initializing major mode, as this operation
 	;; may reset them otherwise.
 	;; may reset them otherwise.
-	(org-set-local 'org-src--from-org-mode org-mode-p)
-	(org-set-local 'org-src--beg-marker beg)
-	(org-set-local 'org-src--end-marker end)
-	(org-set-local 'org-src--remote remote)
-	(org-set-local 'org-src--block-indentation ind)
-	(org-set-local 'org-src--preserve-indentation preserve-ind)
-	(org-set-local 'org-src--overlay overlay)
-	(org-set-local 'org-src--allow-write-back write-back)
+	(setq-local org-src--from-org-mode org-mode-p)
+	(setq-local org-src--beg-marker beg)
+	(setq-local org-src--end-marker end)
+	(setq-local org-src--remote remote)
+	(setq-local org-src--block-indentation ind)
+	(setq-local org-src--preserve-indentation preserve-ind)
+	(setq-local org-src--overlay overlay)
+	(setq-local org-src--allow-write-back write-back)
 	;; Start minor mode.
 	;; Start minor mode.
 	(org-src-mode)
 	(org-src-mode)
 	;; Move mark and point in edit buffer to the corresponding
 	;; Move mark and point in edit buffer to the corresponding
@@ -570,8 +570,8 @@ This minor mode is turned on in two situations:
 See also `org-src-mode-hook'."
 See also `org-src-mode-hook'."
   nil " OrgSrc" nil
   nil " OrgSrc" nil
   (when org-edit-src-persistent-message
   (when org-edit-src-persistent-message
-    (org-set-local
-     'header-line-format
+    (setq-local
+     header-line-format
      (substitute-command-keys
      (substitute-command-keys
       (if org-src--allow-write-back
       (if org-src--allow-write-back
 	  "Edit, then exit with \\[org-edit-src-exit] or abort with \
 	  "Edit, then exit with \\[org-edit-src-exit] or abort with \
@@ -861,11 +861,11 @@ name of the sub-editing buffer."
 	       (org-escape-code-in-region (point-min) (point-max))))
 	       (org-escape-code-in-region (point-min) (point-max))))
        (and code (org-unescape-code-in-string code)))
        (and code (org-unescape-code-in-string code)))
       ;; Finalize buffer.
       ;; Finalize buffer.
-      (org-set-local 'org-coderef-label-format
-		     (or (org-element-property :label-fmt element)
-			 org-coderef-label-format))
+      (setq-local org-coderef-label-format
+		  (or (org-element-property :label-fmt element)
+		      org-coderef-label-format))
       (when (eq type 'src-block)
       (when (eq type 'src-block)
-	(org-set-local 'org-src--babel-info babel-info)
+	(setq-local org-src--babel-info babel-info)
 	(let ((edit-prep-func (intern (concat "org-babel-edit-prep:" lang))))
 	(let ((edit-prep-func (intern (concat "org-babel-edit-prep:" lang))))
 	  (when (fboundp edit-prep-func)
 	  (when (fboundp edit-prep-func)
 	    (funcall edit-prep-func babel-info))))
 	    (funcall edit-prep-func babel-info))))

+ 14 - 17
lisp/org-table.el

@@ -724,13 +724,11 @@ This is being used to correctly align a single field after TAB or RET.")
 (defvar org-table-last-column-widths nil
 (defvar org-table-last-column-widths nil
   "List of max width of fields in each column.
   "List of max width of fields in each column.
 This is being used to correctly align a single field after TAB or RET.")
 This is being used to correctly align a single field after TAB or RET.")
-(defvar org-table-formula-debug nil
+(defvar-local org-table-formula-debug nil
   "Non-nil means debug table formulas.
   "Non-nil means debug table formulas.
 When nil, simply write \"#ERROR\" in corrupted fields.")
 When nil, simply write \"#ERROR\" in corrupted fields.")
-(make-variable-buffer-local 'org-table-formula-debug)
-(defvar org-table-overlay-coordinates nil
+(defvar-local org-table-overlay-coordinates nil
   "Overlay coordinates after each align of a table.")
   "Overlay coordinates after each align of a table.")
-(make-variable-buffer-local 'org-table-overlay-coordinates)
 
 
 (defvar org-last-recalc-line nil)
 (defvar org-last-recalc-line nil)
 (defvar org-table-do-narrow t)   ; for dynamic scoping
 (defvar org-table-do-narrow t)   ; for dynamic scoping
@@ -2025,9 +2023,9 @@ it can be edited in place."
 			      '(invisible t org-cwidth t display t
 			      '(invisible t org-cwidth t display t
 					  intangible t))
 					  intangible t))
       (goto-char p)
       (goto-char p)
-      (org-set-local 'org-finish-function 'org-table-finish-edit-field)
-      (org-set-local 'org-window-configuration cw)
-      (org-set-local 'org-field-marker pos)
+      (setq-local org-finish-function 'org-table-finish-edit-field)
+      (setq-local org-window-configuration cw)
+      (setq-local org-field-marker pos)
       (message "Edit and finish with C-c C-c")))))
       (message "Edit and finish with C-c C-c")))))
 
 
 (defun org-table-finish-edit-field ()
 (defun org-table-finish-edit-field ()
@@ -3526,10 +3524,10 @@ Parameters get priority."
     ;; Keep global-font-lock-mode from turning on font-lock-mode
     ;; Keep global-font-lock-mode from turning on font-lock-mode
     (let ((font-lock-global-modes '(not fundamental-mode)))
     (let ((font-lock-global-modes '(not fundamental-mode)))
       (fundamental-mode))
       (fundamental-mode))
-    (org-set-local 'font-lock-global-modes (list 'not major-mode))
-    (org-set-local 'org-pos pos)
-    (org-set-local 'org-window-configuration wc)
-    (org-set-local 'org-selected-window sel-win)
+    (setq-local font-lock-global-modes (list 'not major-mode))
+    (setq-local org-pos pos)
+    (setq-local org-window-configuration wc)
+    (setq-local org-selected-window sel-win)
     (use-local-map org-table-fedit-map)
     (use-local-map org-table-fedit-map)
     (org-add-hook 'post-command-hook #'org-table-fedit-post-command t t)
     (org-add-hook 'post-command-hook #'org-table-fedit-post-command t t)
     (easy-menu-add org-table-fedit-menu)
     (easy-menu-add org-table-fedit-menu)
@@ -3704,7 +3702,7 @@ minutes or seconds."
 (defun org-table-fedit-toggle-ref-type ()
 (defun org-table-fedit-toggle-ref-type ()
   "Convert all references in the buffer from B3 to @3$2 and back."
   "Convert all references in the buffer from B3 to @3$2 and back."
   (interactive)
   (interactive)
-  (org-set-local 'org-table-buffer-is-an (not org-table-buffer-is-an))
+  (setq-local org-table-buffer-is-an (not org-table-buffer-is-an))
   (org-table-fedit-convert-buffer
   (org-table-fedit-convert-buffer
    (if org-table-buffer-is-an
    (if org-table-buffer-is-an
        'org-table-convert-refs-to-an 'org-table-convert-refs-to-rc))
        'org-table-convert-refs-to-an 'org-table-convert-refs-to-rc))
@@ -4110,9 +4108,8 @@ FACE, when non-nil, for the highlight."
     (mapc 'delete-overlay org-table-rectangle-overlays)
     (mapc 'delete-overlay org-table-rectangle-overlays)
     (setq org-table-rectangle-overlays nil)))
     (setq org-table-rectangle-overlays nil)))
 
 
-(defvar org-table-coordinate-overlays nil
+(defvar-local org-table-coordinate-overlays nil
   "Collects the coordinate grid overlays, so that they can be removed.")
   "Collects the coordinate grid overlays, so that they can be removed.")
-(make-variable-buffer-local 'org-table-coordinate-overlays)
 
 
 (defun org-table-overlay-coordinates ()
 (defun org-table-overlay-coordinates ()
   "Add overlays to the table at point, to show row/column coordinates."
   "Add overlays to the table at point, to show row/column coordinates."
@@ -4229,12 +4226,12 @@ FACE, when non-nil, for the highlight."
       ;; FIXME: maybe it should use emulation-mode-map-alists?
       ;; FIXME: maybe it should use emulation-mode-map-alists?
       (and c (setq minor-mode-map-alist
       (and c (setq minor-mode-map-alist
                    (cons c (delq c minor-mode-map-alist)))))
                    (cons c (delq c minor-mode-map-alist)))))
-    (org-set-local (quote org-table-may-need-update) t)
+    (setq-local org-table-may-need-update t)
     (org-add-hook 'before-change-functions 'org-before-change-function
     (org-add-hook 'before-change-functions 'org-before-change-function
                   nil 'local)
                   nil 'local)
-    (org-set-local 'org-old-auto-fill-inhibit-regexp
+    (setq-local org-old-auto-fill-inhibit-regexp
                    auto-fill-inhibit-regexp)
                    auto-fill-inhibit-regexp)
-    (org-set-local 'auto-fill-inhibit-regexp
+    (setq-local auto-fill-inhibit-regexp
                    (if auto-fill-inhibit-regexp
                    (if auto-fill-inhibit-regexp
                        (concat orgtbl-line-start-regexp "\\|"
                        (concat orgtbl-line-start-regexp "\\|"
                                auto-fill-inhibit-regexp)
                                auto-fill-inhibit-regexp)

+ 122 - 157
lisp/org.el

@@ -63,9 +63,8 @@
 ;;; Code:
 ;;; Code:
 
 
 (defvar org-inhibit-highlight-removal nil) ; dynamically scoped param
 (defvar org-inhibit-highlight-removal nil) ; dynamically scoped param
-(defvar org-table-formula-constants-local nil
+(defvar-local org-table-formula-constants-local nil
   "Local version of `org-table-formula-constants'.")
   "Local version of `org-table-formula-constants'.")
-(make-variable-buffer-local 'org-table-formula-constants-local)
 
 
 ;;;; Require other packages
 ;;;; Require other packages
 
 
@@ -1764,10 +1763,9 @@ calls `table-recognize-table'."
   :tag "Org Link"
   :tag "Org Link"
   :group 'org)
   :group 'org)
 
 
-(defvar org-link-abbrev-alist-local nil
+(defvar-local org-link-abbrev-alist-local nil
   "Buffer-local version of `org-link-abbrev-alist', which see.
   "Buffer-local version of `org-link-abbrev-alist', which see.
 The value of this is taken from the #+LINK lines.")
 The value of this is taken from the #+LINK lines.")
-(make-variable-buffer-local 'org-link-abbrev-alist-local)
 
 
 (defcustom org-link-abbrev-alist nil
 (defcustom org-link-abbrev-alist nil
   "Alist of link abbreviations.
   "Alist of link abbreviations.
@@ -2587,9 +2585,8 @@ taken from the (otherwise obsolete) variable `org-todo-interpretation'."
 		   (repeat
 		   (repeat
 		    (string :tag "Keyword"))))))
 		    (string :tag "Keyword"))))))
 
 
-(defvar org-todo-keywords-1 nil
+(defvar-local org-todo-keywords-1 nil
   "All TODO and DONE keywords active in a buffer.")
   "All TODO and DONE keywords active in a buffer.")
-(make-variable-buffer-local 'org-todo-keywords-1)
 (defvar org-todo-keywords-for-agenda nil)
 (defvar org-todo-keywords-for-agenda nil)
 (defvar org-done-keywords-for-agenda nil)
 (defvar org-done-keywords-for-agenda nil)
 (defvar org-todo-keyword-alist-for-agenda nil)
 (defvar org-todo-keyword-alist-for-agenda nil)
@@ -2597,25 +2594,16 @@ taken from the (otherwise obsolete) variable `org-todo-interpretation'."
   "Alist of all tags from all agenda files.")
   "Alist of all tags from all agenda files.")
 (defvar org-tag-groups-alist-for-agenda nil
 (defvar org-tag-groups-alist-for-agenda nil
   "Alist of all groups tags from all current agenda files.")
   "Alist of all groups tags from all current agenda files.")
-(defvar org-tag-groups-alist nil)
-(make-variable-buffer-local 'org-tag-groups-alist)
+(defvar-local org-tag-groups-alist nil)
 (defvar org-agenda-contributing-files nil)
 (defvar org-agenda-contributing-files nil)
-(defvar org-not-done-keywords nil)
-(make-variable-buffer-local 'org-not-done-keywords)
-(defvar org-done-keywords nil)
-(make-variable-buffer-local 'org-done-keywords)
-(defvar org-todo-heads nil)
-(make-variable-buffer-local 'org-todo-heads)
-(defvar org-todo-sets nil)
-(make-variable-buffer-local 'org-todo-sets)
-(defvar org-todo-log-states nil)
-(make-variable-buffer-local 'org-todo-log-states)
-(defvar org-todo-kwd-alist nil)
-(make-variable-buffer-local 'org-todo-kwd-alist)
-(defvar org-todo-key-alist nil)
-(make-variable-buffer-local 'org-todo-key-alist)
-(defvar org-todo-key-trigger nil)
-(make-variable-buffer-local 'org-todo-key-trigger)
+(defvar-local org-not-done-keywords nil)
+(defvar-local org-done-keywords nil)
+(defvar-local org-todo-heads nil)
+(defvar-local org-todo-sets nil)
+(defvar-local org-todo-log-states nil)
+(defvar-local org-todo-kwd-alist nil)
+(defvar-local org-todo-key-alist nil)
+(defvar-local org-todo-key-trigger nil)
 
 
 (defcustom org-todo-interpretation 'sequence
 (defcustom org-todo-interpretation 'sequence
   "Controls how TODO keywords are interpreted.
   "Controls how TODO keywords are interpreted.
@@ -3530,9 +3518,7 @@ tags in that file can be created dynamically (there are none).
 
 
   (add-hook \\='org-capture-mode-hook
   (add-hook \\='org-capture-mode-hook
             (lambda ()
             (lambda ()
-              (set (make-local-variable
-                    \\='org-complete-tags-always-offer-all-agenda-tags)
-                   t)))"
+              (setq-local org-complete-tags-always-offer-all-agenda-tags t)))"
   :group 'org-tags
   :group 'org-tags
   :version "24.1"
   :version "24.1"
   :type 'boolean)
   :type 'boolean)
@@ -3809,18 +3795,17 @@ You can set buffer-local values for the same purpose in the variable
 	  (cons (string :tag "Property")
 	  (cons (string :tag "Property")
 		(string :tag "Value"))))
 		(string :tag "Value"))))
 
 
-(defvar org-file-properties nil
+(defvar-local org-file-properties nil
   "List of property/value pairs that can be inherited by any entry.
   "List of property/value pairs that can be inherited by any entry.
 Valid for the current buffer.
 Valid for the current buffer.
 This variable is populated from #+PROPERTY lines.")
 This variable is populated from #+PROPERTY lines.")
-(make-variable-buffer-local 'org-file-properties)
 
 
 (defgroup org-agenda nil
 (defgroup org-agenda nil
   "Options concerning agenda views in Org-mode."
   "Options concerning agenda views in Org-mode."
   :tag "Org Agenda"
   :tag "Org Agenda"
   :group 'org)
   :group 'org)
 
 
-(defvar org-category nil
+(defvar-local org-category nil
   "Variable used by org files to set a category for agenda display.
   "Variable used by org files to set a category for agenda display.
 Such files should use a file variable to set it, for example
 Such files should use a file variable to set it, for example
 
 
@@ -3832,7 +3817,6 @@ or contain a special line
 
 
 If the file does not specify a category, then file's base name
 If the file does not specify a category, then file's base name
 is used instead.")
 is used instead.")
-(make-variable-buffer-local 'org-category)
 (put 'org-category 'safe-local-variable (lambda (x) (or (symbolp x) (stringp x))))
 (put 'org-category 'safe-local-variable (lambda (x) (or (symbolp x) (stringp x))))
 
 
 (defcustom org-agenda-files nil
 (defcustom org-agenda-files nil
@@ -4799,36 +4783,29 @@ Otherwise, these types are allowed:
 
 
 ;;; Variables for pre-computed regular expressions, all buffer local
 ;;; Variables for pre-computed regular expressions, all buffer local
 
 
-(defvar org-todo-regexp nil
+(defvar-local org-todo-regexp nil
   "Matches any of the TODO state keywords.")
   "Matches any of the TODO state keywords.")
-(make-variable-buffer-local 'org-todo-regexp)
-(defvar org-not-done-regexp nil
+(defvar-local org-not-done-regexp nil
   "Matches any of the TODO state keywords except the last one.")
   "Matches any of the TODO state keywords except the last one.")
-(make-variable-buffer-local 'org-not-done-regexp)
-(defvar org-not-done-heading-regexp nil
+(defvar-local org-not-done-heading-regexp nil
   "Matches a TODO headline that is not done.")
   "Matches a TODO headline that is not done.")
-(make-variable-buffer-local 'org-not-done-heading-regexp)
-(defvar org-todo-line-regexp nil
+(defvar-local org-todo-line-regexp nil
   "Matches a headline and puts TODO state into group 2 if present.")
   "Matches a headline and puts TODO state into group 2 if present.")
-(make-variable-buffer-local 'org-todo-line-regexp)
-(defvar org-complex-heading-regexp nil
+(defvar-local org-complex-heading-regexp nil
   "Matches a headline and puts everything into groups:
   "Matches a headline and puts everything into groups:
 group 1: the stars
 group 1: the stars
 group 2: The todo keyword, maybe
 group 2: The todo keyword, maybe
 group 3: Priority cookie
 group 3: Priority cookie
 group 4: True headline
 group 4: True headline
 group 5: Tags")
 group 5: Tags")
-(make-variable-buffer-local 'org-complex-heading-regexp)
-(defvar org-complex-heading-regexp-format nil
+(defvar-local org-complex-heading-regexp-format nil
   "Printf format to make regexp to match an exact headline.
   "Printf format to make regexp to match an exact headline.
 This regexp will match the headline of any node which has the
 This regexp will match the headline of any node which has the
 exact headline text that is put into the format, but may have any
 exact headline text that is put into the format, but may have any
 TODO state, priority and tags.")
 TODO state, priority and tags.")
-(make-variable-buffer-local 'org-complex-heading-regexp-format)
-(defvar org-todo-line-tags-regexp nil
+(defvar-local org-todo-line-tags-regexp nil
   "Matches a headline and puts TODO state into group 2 if present.
   "Matches a headline and puts TODO state into group 2 if present.
 Also put tags into group 4 if tags are present.")
 Also put tags into group 4 if tags are present.")
-(make-variable-buffer-local 'org-todo-line-tags-regexp)
 
 
 (defconst org-plain-time-of-day-regexp
 (defconst org-plain-time-of-day-regexp
   (concat
   (concat
@@ -4973,20 +4950,20 @@ related expressions."
        (cdr (assq 'tags alist)) (cdr (assq 'filetags alist)))
        (cdr (assq 'tags alist)) (cdr (assq 'filetags alist)))
       (unless tags-only
       (unless tags-only
 	;; File properties.
 	;; File properties.
-	(org-set-local 'org-file-properties (cdr (assq 'property alist)))
+	(setq-local org-file-properties (cdr (assq 'property alist)))
 	;; Archive location.
 	;; Archive location.
 	(let ((archive (cdr (assq 'archive alist))))
 	(let ((archive (cdr (assq 'archive alist))))
-	  (when archive (org-set-local 'org-archive-location archive)))
+	  (when archive (setq-local org-archive-location archive)))
 	;; Category.
 	;; Category.
 	(let ((cat (org-string-nw-p (cdr (assq 'category alist)))))
 	(let ((cat (org-string-nw-p (cdr (assq 'category alist)))))
 	  (when cat
 	  (when cat
-	    (org-set-local 'org-category (intern cat))
-	    (org-set-local 'org-file-properties
-			   (org--update-property-plist
-			    "CATEGORY" cat org-file-properties))))
+	    (setq-local org-category (intern cat))
+	    (setq-local org-file-properties
+			(org--update-property-plist
+			 "CATEGORY" cat org-file-properties))))
 	;; Columns.
 	;; Columns.
 	(let ((column (cdr (assq 'columns alist))))
 	(let ((column (cdr (assq 'columns alist))))
-	  (when column (org-set-local 'org-columns-default-format column)))
+	  (when column (setq-local org-columns-default-format column)))
 	;; Constants.
 	;; Constants.
 	(setq org-table-formula-constants-local (cdr (assq 'constants alist)))
 	(setq org-table-formula-constants-local (cdr (assq 'constants alist)))
 	;; Link abbreviations.
 	;; Link abbreviations.
@@ -4995,13 +4972,13 @@ related expressions."
 	;; Priorities.
 	;; Priorities.
 	(let ((priorities (cdr (assq 'priorities alist))))
 	(let ((priorities (cdr (assq 'priorities alist))))
 	  (when priorities
 	  (when priorities
-	    (org-set-local 'org-highest-priority (nth 0 priorities))
-	    (org-set-local 'org-lowest-priority (nth 1 priorities))
-	    (org-set-local 'org-default-priority (nth 2 priorities))))
+	    (setq-local org-highest-priority (nth 0 priorities))
+	    (setq-local org-lowest-priority (nth 1 priorities))
+	    (setq-local org-default-priority (nth 2 priorities))))
 	;; Scripts.
 	;; Scripts.
 	(let ((scripts (assq 'scripts alist)))
 	(let ((scripts (assq 'scripts alist)))
 	  (when scripts
 	  (when scripts
-	    (org-set-local 'org-use-sub-superscripts (cdr scripts))))
+	    (setq-local org-use-sub-superscripts (cdr scripts))))
 	;; Startup options.
 	;; Startup options.
 	(let ((startup (cdr (assq 'startup alist))))
 	(let ((startup (cdr (assq 'startup alist))))
 	  (dolist (option startup)
 	  (dolist (option startup)
@@ -5009,19 +4986,19 @@ related expressions."
 	      (when entry
 	      (when entry
 		(let ((var (nth 1 entry))
 		(let ((var (nth 1 entry))
 		      (val (nth 2 entry)))
 		      (val (nth 2 entry)))
-		  (if (not (nth 3 entry)) (org-set-local var val)
+		  (if (not (nth 3 entry)) (set (make-local-variable var) val)
 		    (unless (listp (symbol-value var))
 		    (unless (listp (symbol-value var))
-		      (org-set-local var nil))
+		      (set (make-local-variable var) nil))
 		    (add-to-list var val)))))))
 		    (add-to-list var val)))))))
 	;; TODO keywords.
 	;; TODO keywords.
-	(org-set-local 'org-todo-kwd-alist nil)
-	(org-set-local 'org-todo-key-alist nil)
-	(org-set-local 'org-todo-key-trigger nil)
-	(org-set-local 'org-todo-keywords-1 nil)
-	(org-set-local 'org-done-keywords nil)
-	(org-set-local 'org-todo-heads nil)
-	(org-set-local 'org-todo-sets nil)
-	(org-set-local 'org-todo-log-states nil)
+	(setq-local org-todo-kwd-alist nil)
+	(setq-local org-todo-key-alist nil)
+	(setq-local org-todo-key-trigger nil)
+	(setq-local org-todo-keywords-1 nil)
+	(setq-local org-done-keywords nil)
+	(setq-local org-todo-heads nil)
+	(setq-local org-todo-sets nil)
+	(setq-local org-todo-log-states nil)
 	(let ((todo-sequences
 	(let ((todo-sequences
 	       (or (nreverse (cdr (assq 'todo alist)))
 	       (or (nreverse (cdr (assq 'todo alist)))
 		   (let ((d (default-value 'org-todo-keywords)))
 		   (let ((d (default-value 'org-todo-keywords)))
@@ -5221,8 +5198,8 @@ Return value contains the following keys: `archive', `category',
 TAGS is a list of tags and tag group symbols, as strings.
 TAGS is a list of tags and tag group symbols, as strings.
 FILETAGS is a list of tags, as strings."
 FILETAGS is a list of tags, as strings."
   ;; Process the file tags.
   ;; Process the file tags.
-  (org-set-local 'org-file-tags
-		 (mapcar #'org-add-prop-inherited filetags))
+  (setq-local org-file-tags
+	      (mapcar #'org-add-prop-inherited filetags))
   ;; Provide default tags if no local tags are found.
   ;; Provide default tags if no local tags are found.
   (when (and (not tags) org-tag-alist)
   (when (and (not tags) org-tag-alist)
     (setq tags
     (setq tags
@@ -5239,8 +5216,8 @@ FILETAGS is a list of tags, as strings."
 					      (format "(%c)" (cdr tag)))))))
 					      (format "(%c)" (cdr tag)))))))
 		  org-tag-alist)))
 		  org-tag-alist)))
   ;; Process the tags.
   ;; Process the tags.
-  (org-set-local 'org-tag-groups-alist nil)
-  (org-set-local 'org-tag-alist nil)
+  (setq-local org-tag-groups-alist nil)
+  (setq-local org-tag-alist nil)
   (let (group-flag)
   (let (group-flag)
     (while tags
     (while tags
       (let ((e (car tags)))
       (let ((e (car tags)))
@@ -5444,9 +5421,9 @@ The following commands are available:
   (add-to-invisibility-spec '(org-cwidth))
   (add-to-invisibility-spec '(org-cwidth))
   (add-to-invisibility-spec '(org-hide-block . t))
   (add-to-invisibility-spec '(org-hide-block . t))
   (when (featurep 'xemacs)
   (when (featurep 'xemacs)
-    (org-set-local 'line-move-ignore-invisible t))
-  (org-set-local 'outline-regexp org-outline-regexp)
-  (org-set-local 'outline-level 'org-outline-level)
+    (setq-local line-move-ignore-invisible t))
+  (setq-local outline-regexp org-outline-regexp)
+  (setq-local outline-level 'org-outline-level)
   (setq bidi-paragraph-direction 'left-to-right)
   (setq bidi-paragraph-direction 'left-to-right)
   (when (and org-ellipsis
   (when (and org-ellipsis
              (fboundp 'set-display-table-slot) (boundp 'buffer-display-table)
              (fboundp 'set-display-table-slot) (boundp 'buffer-display-table)
@@ -5466,7 +5443,7 @@ The following commands are available:
     ;; tag faces set outside customize.... force initialization.
     ;; tag faces set outside customize.... force initialization.
     (org-set-tag-faces 'org-tag-faces org-tag-faces))
     (org-set-tag-faces 'org-tag-faces org-tag-faces))
   ;; Calc embedded
   ;; Calc embedded
-  (org-set-local 'calc-embedded-open-mode "# ")
+  (setq-local calc-embedded-open-mode "# ")
   ;; Modify a few syntax entries
   ;; Modify a few syntax entries
   (modify-syntax-entry ?@ "w")
   (modify-syntax-entry ?@ "w")
   (modify-syntax-entry ?\" "\"")
   (modify-syntax-entry ?\" "\"")
@@ -5474,10 +5451,10 @@ The following commands are available:
   (modify-syntax-entry ?~ "_")
   (modify-syntax-entry ?~ "_")
   (if org-startup-truncated (setq truncate-lines t))
   (if org-startup-truncated (setq truncate-lines t))
   (when org-startup-indented (require 'org-indent) (org-indent-mode 1))
   (when org-startup-indented (require 'org-indent) (org-indent-mode 1))
-  (org-set-local 'font-lock-unfontify-region-function
-		 'org-unfontify-region)
+  (setq-local font-lock-unfontify-region-function
+	      'org-unfontify-region)
   ;; Activate before-change-function
   ;; Activate before-change-function
-  (org-set-local 'org-table-may-need-update t)
+  (setq-local org-table-may-need-update t)
   (org-add-hook 'before-change-functions 'org-before-change-function nil
   (org-add-hook 'before-change-functions 'org-before-change-function nil
 		'local)
 		'local)
   ;; Check for running clock before killing a buffer
   ;; Check for running clock before killing a buffer
@@ -5487,8 +5464,8 @@ The following commands are available:
   ;; Initialize radio targets.
   ;; Initialize radio targets.
   (org-update-radio-target-regexp)
   (org-update-radio-target-regexp)
   ;; Indentation.
   ;; Indentation.
-  (org-set-local 'indent-line-function 'org-indent-line)
-  (org-set-local 'indent-region-function 'org-indent-region)
+  (setq-local indent-line-function 'org-indent-line)
+  (setq-local indent-region-function 'org-indent-region)
   ;; Filling and auto-filling.
   ;; Filling and auto-filling.
   (org-setup-filling)
   (org-setup-filling)
   ;; Comments.
   ;; Comments.
@@ -5496,15 +5473,15 @@ The following commands are available:
   ;; Initialize cache.
   ;; Initialize cache.
   (org-element-cache-reset)
   (org-element-cache-reset)
   ;; Beginning/end of defun
   ;; Beginning/end of defun
-  (org-set-local 'beginning-of-defun-function 'org-backward-element)
-  (org-set-local 'end-of-defun-function
-		 (lambda ()
-		   (if (not (org-at-heading-p))
-		       (org-forward-element)
-		     (org-forward-element)
-		     (forward-char -1))))
+  (setq-local beginning-of-defun-function 'org-backward-element)
+  (setq-local end-of-defun-function
+	      (lambda ()
+		(if (not (org-at-heading-p))
+		    (org-forward-element)
+		  (org-forward-element)
+		  (forward-char -1))))
   ;; Next error for sparse trees
   ;; Next error for sparse trees
-  (org-set-local 'next-error-function 'org-occur-next-match)
+  (setq-local next-error-function 'org-occur-next-match)
   ;; Make sure dependence stuff works reliably, even for users who set it
   ;; Make sure dependence stuff works reliably, even for users who set it
   ;; too late :-(
   ;; too late :-(
   (if org-enforce-todo-dependencies
   (if org-enforce-todo-dependencies
@@ -5519,15 +5496,15 @@ The following commands are available:
 		 'org-block-todo-from-checkboxes))
 		 'org-block-todo-from-checkboxes))
 
 
   ;; Align options lines
   ;; Align options lines
-  (org-set-local
-   'align-mode-rules-list
+  (setq-local
+   align-mode-rules-list
    '((org-in-buffer-settings
    '((org-in-buffer-settings
       (regexp . "^[ \t]*#\\+[A-Z_]+:\\(\\s-*\\)\\S-+")
       (regexp . "^[ \t]*#\\+[A-Z_]+:\\(\\s-*\\)\\S-+")
       (modes . '(org-mode)))))
       (modes . '(org-mode)))))
 
 
   ;; Imenu
   ;; Imenu
-  (org-set-local 'imenu-create-index-function
-		 'org-imenu-get-tree)
+  (setq-local imenu-create-index-function
+	      'org-imenu-get-tree)
 
 
   ;; Make isearch reveal context
   ;; Make isearch reveal context
   (if (or (featurep 'xemacs)
   (if (or (featurep 'xemacs)
@@ -5535,21 +5512,20 @@ The following commands are available:
       ;; Emacs 21 and XEmacs make use of the hook
       ;; Emacs 21 and XEmacs make use of the hook
       (org-add-hook 'isearch-mode-end-hook 'org-isearch-end 'append 'local)
       (org-add-hook 'isearch-mode-end-hook 'org-isearch-end 'append 'local)
     ;; Emacs 22 deals with this through a special variable
     ;; Emacs 22 deals with this through a special variable
-    (org-set-local 'outline-isearch-open-invisible-function
-		   (lambda (&rest ignore) (org-show-context 'isearch))))
+    (setq-local outline-isearch-open-invisible-function
+		(lambda (&rest ignore) (org-show-context 'isearch))))
 
 
   ;; Setup the pcomplete hooks
   ;; Setup the pcomplete hooks
-  (set (make-local-variable 'pcomplete-command-completion-function)
-       'org-pcomplete-initial)
-  (set (make-local-variable 'pcomplete-command-name-function)
-       'org-command-at-point)
-  (set (make-local-variable 'pcomplete-default-completion-function)
-       'ignore)
-  (set (make-local-variable 'pcomplete-parse-arguments-function)
-       'org-parse-arguments)
-  (set (make-local-variable 'pcomplete-termination-string) "")
-  (when (>= emacs-major-version 23)
-    (set (make-local-variable 'buffer-face-mode-face) 'org-default))
+  (setq-local pcomplete-command-completion-function
+	      'org-pcomplete-initial)
+  (setq-local pcomplete-command-name-function
+	      'org-command-at-point)
+  (setq-local pcomplete-default-completion-function
+	      'ignore)
+  (setq-local pcomplete-parse-arguments-function
+	      'org-parse-arguments)
+  (setq-local pcomplete-termination-string "")
+  (setq-local buffer-face-mode-face 'org-default)
 
 
   ;; If empty file that did not turn on org-mode automatically, make it to.
   ;; If empty file that did not turn on org-mode automatically, make it to.
   (if (and org-insert-mode-line-in-empty-file
   (if (and org-insert-mode-line-in-empty-file
@@ -6093,9 +6069,8 @@ by a #."
 	  (org-display-custom-time (match-beginning 1) (match-end 1)))
 	  (org-display-custom-time (match-beginning 1) (match-end 1)))
 	t)))
 	t)))
 
 
-(defvar org-target-link-regexp nil
+(defvar-local org-target-link-regexp nil
   "Regular expression matching radio targets in plain text.")
   "Regular expression matching radio targets in plain text.")
-(make-variable-buffer-local 'org-target-link-regexp)
 
 
 (defconst org-target-regexp (let ((border "[^<>\n\r \t]"))
 (defconst org-target-regexp (let ((border "[^<>\n\r \t]"))
 			      (format "<<\\(%s\\|%s[^<>\n\r]*%s\\)>>"
 			      (format "<<\\(%s\\|%s[^<>\n\r]*%s\\)>>"
@@ -6189,8 +6164,8 @@ Also refresh fontification if needed."
 (defun org-compute-latex-and-related-regexp ()
 (defun org-compute-latex-and-related-regexp ()
   "Compute regular expression for LaTeX, entities and sub/superscript.
   "Compute regular expression for LaTeX, entities and sub/superscript.
 Result depends on variable `org-highlight-latex-and-related'."
 Result depends on variable `org-highlight-latex-and-related'."
-  (org-set-local
-   'org-latex-and-related-regexp
+  (setq-local
+   org-latex-and-related-regexp
    (let* ((re-sub
    (let* ((re-sub
 	   (cond ((not (memq 'script org-highlight-latex-and-related)) nil)
 	   (cond ((not (memq 'script org-highlight-latex-and-related)) nil)
 		 ((eq org-use-sub-superscripts '{})
 		 ((eq org-use-sub-superscripts '{})
@@ -6418,15 +6393,15 @@ needs to be inserted at a specific position in the font-lock sequence.")
     (setq org-font-lock-extra-keywords (delq nil org-font-lock-extra-keywords))
     (setq org-font-lock-extra-keywords (delq nil org-font-lock-extra-keywords))
     (run-hooks 'org-font-lock-set-keywords-hook)
     (run-hooks 'org-font-lock-set-keywords-hook)
     ;; Now set the full font-lock-keywords
     ;; Now set the full font-lock-keywords
-    (org-set-local 'org-font-lock-keywords org-font-lock-extra-keywords)
-    (org-set-local 'font-lock-defaults
-		   '(org-font-lock-keywords t nil nil backward-paragraph))
+    (setq-local org-font-lock-keywords org-font-lock-extra-keywords)
+    (setq-local font-lock-defaults
+		'(org-font-lock-keywords t nil nil backward-paragraph))
     (kill-local-variable 'font-lock-keywords) nil))
     (kill-local-variable 'font-lock-keywords) nil))
 
 
 (defun org-toggle-pretty-entities ()
 (defun org-toggle-pretty-entities ()
   "Toggle the composition display of entities as UTF8 characters."
   "Toggle the composition display of entities as UTF8 characters."
   (interactive)
   (interactive)
-  (org-set-local 'org-pretty-entities (not org-pretty-entities))
+  (setq-local org-pretty-entities (not org-pretty-entities))
   (org-restart-font-lock)
   (org-restart-font-lock)
   (if org-pretty-entities
   (if org-pretty-entities
       (message "Entities are now displayed as UTF8 characters")
       (message "Entities are now displayed as UTF8 characters")
@@ -6435,9 +6410,8 @@ needs to be inserted at a specific position in the font-lock sequence.")
       (org-decompose-region (point-min) (point-max))
       (org-decompose-region (point-min) (point-max))
       (message "Entities are now displayed as plain text"))))
       (message "Entities are now displayed as plain text"))))
 
 
-(defvar org-custom-properties-overlays nil
+(defvar-local org-custom-properties-overlays nil
   "List of overlays used for custom properties.")
   "List of overlays used for custom properties.")
-(make-variable-buffer-local 'org-custom-properties-overlays)
 
 
 (defun org-toggle-custom-properties-visibility ()
 (defun org-toggle-custom-properties-visibility ()
   "Display or hide properties in `org-custom-properties'."
   "Display or hide properties in `org-custom-properties'."
@@ -6643,11 +6617,9 @@ and subscripts."
 
 
 ;;; Cycling
 ;;; Cycling
 
 
-(defvar org-cycle-global-status nil)
-(make-variable-buffer-local 'org-cycle-global-status)
+(defvar-local org-cycle-global-status nil)
 (put 'org-cycle-global-status 'org-state t)
 (put 'org-cycle-global-status 'org-state t)
-(defvar org-cycle-subtree-status nil)
-(make-variable-buffer-local 'org-cycle-subtree-status)
+(defvar-local org-cycle-subtree-status nil)
 (put 'org-cycle-subtree-status 'org-state t)
 (put 'org-cycle-subtree-status 'org-state t)
 
 
 (defvar org-inlinetask-min-level)
 (defvar org-inlinetask-min-level)
@@ -7295,9 +7267,8 @@ DATA should have been made by `org-outline-overlay-data'."
 
 
 ;;; Folding of blocks
 ;;; Folding of blocks
 
 
-(defvar org-hide-block-overlays nil
+(defvar-local org-hide-block-overlays nil
   "Overlays hiding blocks.")
   "Overlays hiding blocks.")
-(make-variable-buffer-local 'org-hide-block-overlays)
 
 
 (defun org-block-map (function &optional start end)
 (defun org-block-map (function &optional start end)
   "Call FUNCTION at the head of all source blocks in the current buffer.
   "Call FUNCTION at the head of all source blocks in the current buffer.
@@ -9151,8 +9122,7 @@ defined by Org-mode)."
   "Unconditionally turn on `orgstruct-mode'."
   "Unconditionally turn on `orgstruct-mode'."
   (orgstruct-mode 1))
   (orgstruct-mode 1))
 
 
-(defvar org-fb-vars nil)
-(make-variable-buffer-local 'org-fb-vars)
+(defvar-local org-fb-vars nil)
 (defun orgstruct++-mode (&optional arg)
 (defun orgstruct++-mode (&optional arg)
   "Toggle `orgstruct-mode', the enhanced version of it.
   "Toggle `orgstruct-mode', the enhanced version of it.
 In addition to setting orgstruct-mode, this also exports all
 In addition to setting orgstruct-mode, this also exports all
@@ -9163,8 +9133,8 @@ buffer.  It will also recognize item context in multiline items."
   (if (< arg 1)
   (if (< arg 1)
       (progn (orgstruct-mode -1)
       (progn (orgstruct-mode -1)
 	     (mapc (lambda(v)
 	     (mapc (lambda(v)
-		     (org-set-local (car v)
-				    (if (eq (car-safe (cadr v)) 'quote) (cadadr v) (cadr v))))
+		     (set (make-local-variable (car v))
+			  (if (eq (car-safe (cadr v)) 'quote) (cadadr v) (cadr v))))
 		   org-fb-vars))
 		   org-fb-vars))
     (orgstruct-mode 1)
     (orgstruct-mode 1)
     (setq org-fb-vars nil)
     (setq org-fb-vars nil)
@@ -9178,13 +9148,13 @@ buffer.  It will also recognize item context in multiline items."
 		(symbol-name (car x)))
 		(symbol-name (car x)))
 	   (setq var (car x) val (nth 1 x))
 	   (setq var (car x) val (nth 1 x))
 	   (push (list var `(quote ,(eval var))) org-fb-vars)
 	   (push (list var `(quote ,(eval var))) org-fb-vars)
-	   (org-set-local var (if (eq (car-safe val) 'quote) (nth 1 val) val))))
+	   (set (make-local-variable var)
+		(if (eq (car-safe val) 'quote) (nth 1 val) val))))
        org-local-vars)
        org-local-vars)
-      (org-set-local 'orgstruct-is-++ t))))
+      (setq-local orgstruct-is-++ t))))
 
 
-(defvar orgstruct-is-++ nil
+(defvar-local orgstruct-is-++ nil
   "Is `orgstruct-mode' in ++ version in the current-buffer?")
   "Is `orgstruct-mode' in ++ version in the current-buffer?")
-(make-variable-buffer-local 'orgstruct-is-++)
 
 
 ;;;###autoload
 ;;;###autoload
 (defun turn-on-orgstruct++ ()
 (defun turn-on-orgstruct++ ()
@@ -13088,7 +13058,7 @@ Returns the new TODO keyword, or nil if no state change should occur."
 	    (set-buffer (get-buffer-create " *Org todo*"))
 	    (set-buffer (get-buffer-create " *Org todo*"))
 	  (org-switch-to-buffer-other-window (get-buffer-create " *Org todo*")))
 	  (org-switch-to-buffer-other-window (get-buffer-create " *Org todo*")))
 	(erase-buffer)
 	(erase-buffer)
-	(org-set-local 'org-done-keywords done-keywords)
+	(setq-local org-done-keywords done-keywords)
 	(setq tbl fulltable cnt 0)
 	(setq tbl fulltable cnt 0)
 	(while (setq e (pop tbl))
 	(while (setq e (pop tbl))
 	  (cond
 	  (cond
@@ -13737,7 +13707,7 @@ EXTRA is additional text that will be inserted into the notes buffer."
 		      "this entry")
 		      "this entry")
 		     (t (error "This should not happen")))))
 		     (t (error "This should not happen")))))
     (if org-log-note-extra (insert org-log-note-extra))
     (if org-log-note-extra (insert org-log-note-extra))
-    (org-set-local 'org-finish-function 'org-store-log-note)
+    (setq-local org-finish-function 'org-store-log-note)
     (run-hooks 'org-log-buffer-setup-hook)))
     (run-hooks 'org-log-buffer-setup-hook)))
 
 
 (defvar org-note-abort nil) ; dynamically scoped
 (defvar org-note-abort nil) ; dynamically scoped
@@ -13901,10 +13871,9 @@ D      Show deadlines and scheduled items between a date range."
       ((?r ?R ?/) (call-interactively 'org-occur))
       ((?r ?R ?/) (call-interactively 'org-occur))
       (otherwise (user-error "No such sparse tree command \"%c\"" answer)))))
       (otherwise (user-error "No such sparse tree command \"%c\"" answer)))))
 
 
-(defvar org-occur-highlights nil
+(defvar-local org-occur-highlights nil
   "List of overlays used for occur matches.")
   "List of overlays used for occur matches.")
-(make-variable-buffer-local 'org-occur-highlights)
-(defvar org-occur-parameters nil
+(defvar-local org-occur-parameters nil
   "Parameters of the active org-occur calls.
   "Parameters of the active org-occur calls.
 This is a list, each call to org-occur pushes as cons cell,
 This is a list, each call to org-occur pushes as cons cell,
 containing the regular expression and the callback, onto the list.
 containing the regular expression and the callback, onto the list.
@@ -13914,7 +13883,6 @@ will only contain one set of parameters.  When the highlights are
 removed (for example with `C-c C-c', or with the next edit (depending
 removed (for example with `C-c C-c', or with the next edit (depending
 on `org-remove-highlights-with-change'), this variable is emptied
 on `org-remove-highlights-with-change'), this variable is emptied
 as well.")
 as well.")
-(make-variable-buffer-local 'org-occur-parameters)
 
 
 (defun org-occur (regexp &optional keep-previous callback)
 (defun org-occur (regexp &optional keep-previous callback)
   "Make a compact tree which shows all matches of REGEXP.
   "Make a compact tree which shows all matches of REGEXP.
@@ -15227,7 +15195,7 @@ Returns the new tags string, or nil to not change the current settings."
 	(set-window-buffer (split-window-vertically) (get-buffer-create " *Org tags*"))
 	(set-window-buffer (split-window-vertically) (get-buffer-create " *Org tags*"))
 	(org-switch-to-buffer-other-window " *Org tags*"))
 	(org-switch-to-buffer-other-window " *Org tags*"))
       (erase-buffer)
       (erase-buffer)
-      (org-set-local 'org-done-keywords done-keywords)
+      (setq-local org-done-keywords done-keywords)
       (org-fast-tag-insert "Inherited" inherited i-face "\n")
       (org-fast-tag-insert "Inherited" inherited i-face "\n")
       (org-fast-tag-insert "Current" current c-face "\n\n")
       (org-fast-tag-insert "Current" current c-face "\n\n")
       (org-fast-tag-show-exit exit-after-next)
       (org-fast-tag-show-exit exit-after-next)
@@ -18563,7 +18531,7 @@ the buffer and restores the previous window configuration."
   (if (stringp org-agenda-files)
   (if (stringp org-agenda-files)
       (let ((cw (current-window-configuration)))
       (let ((cw (current-window-configuration)))
 	(find-file org-agenda-files)
 	(find-file org-agenda-files)
-	(org-set-local 'org-window-configuration cw)
+	(setq-local org-window-configuration cw)
 	(org-add-hook 'after-save-hook
 	(org-add-hook 'after-save-hook
 		      (lambda ()
 		      (lambda ()
 			(set-window-configuration
 			(set-window-configuration
@@ -18984,9 +18952,8 @@ looks only before point, not after."
     (org-in-regexp
     (org-in-regexp
      "\\\\[a-zA-Z]+\\*?\\(\\(\\[[^][\n{}]*\\]\\)\\|\\({[^{}\n]*}\\)\\)*")))
      "\\\\[a-zA-Z]+\\*?\\(\\(\\[[^][\n{}]*\\]\\)\\|\\({[^{}\n]*}\\)\\)*")))
 
 
-(defvar org-latex-fragment-image-overlays nil
+(defvar-local org-latex-fragment-image-overlays nil
   "List of overlays carrying the images of latex fragments.")
   "List of overlays carrying the images of latex fragments.")
-(make-variable-buffer-local 'org-latex-fragment-image-overlays)
 
 
 (defun org-remove-latex-fragment-image-overlays (&optional beg end)
 (defun org-remove-latex-fragment-image-overlays (&optional beg end)
   "Remove all overlays with LaTeX fragment images in current buffer.
   "Remove all overlays with LaTeX fragment images in current buffer.
@@ -19593,8 +19560,7 @@ SNIPPETS-P indicates if this is run to create snippet images for HTML."
 
 
 ;; Image display
 ;; Image display
 
 
-(defvar org-inline-image-overlays nil)
-(make-variable-buffer-local 'org-inline-image-overlays)
+(defvar-local org-inline-image-overlays nil)
 
 
 (defun org-toggle-inline-images (&optional include-linked)
 (defun org-toggle-inline-images (&optional include-linked)
   "Toggle the display of inline images.
   "Toggle the display of inline images.
@@ -23281,20 +23247,20 @@ assumed to be significant there."
   (require 'org-element)
   (require 'org-element)
   ;; Prevent auto-fill from inserting unwanted new items.
   ;; Prevent auto-fill from inserting unwanted new items.
   (when (boundp 'fill-nobreak-predicate)
   (when (boundp 'fill-nobreak-predicate)
-    (org-set-local
-     'fill-nobreak-predicate
+    (setq-local
+     fill-nobreak-predicate
      (org-uniquify
      (org-uniquify
       (append fill-nobreak-predicate
       (append fill-nobreak-predicate
 	      '(org-fill-line-break-nobreak-p
 	      '(org-fill-line-break-nobreak-p
 		org-fill-paragraph-with-timestamp-nobreak-p)))))
 		org-fill-paragraph-with-timestamp-nobreak-p)))))
   (let ((paragraph-ending (substring org-element-paragraph-separate 1)))
   (let ((paragraph-ending (substring org-element-paragraph-separate 1)))
-    (org-set-local 'paragraph-start paragraph-ending)
-    (org-set-local 'paragraph-separate paragraph-ending))
-  (org-set-local 'fill-paragraph-function 'org-fill-paragraph)
-  (org-set-local 'auto-fill-inhibit-regexp nil)
-  (org-set-local 'adaptive-fill-function 'org-adaptive-fill-function)
-  (org-set-local 'normal-auto-fill-function 'org-auto-fill-function)
-  (org-set-local 'comment-line-break-function 'org-comment-line-break-function))
+    (setq-local paragraph-start paragraph-ending)
+    (setq-local paragraph-separate paragraph-ending))
+  (setq-local fill-paragraph-function 'org-fill-paragraph)
+  (setq-local auto-fill-inhibit-regexp nil)
+  (setq-local adaptive-fill-function 'org-adaptive-fill-function)
+  (setq-local normal-auto-fill-function 'org-auto-fill-function)
+  (setq-local comment-line-break-function 'org-comment-line-break-function))
 
 
 (defun org-fill-line-break-nobreak-p ()
 (defun org-fill-line-break-nobreak-p ()
   "Non-nil when a new line at point would create an Org line break."
   "Non-nil when a new line at point would create an Org line break."
@@ -23683,12 +23649,12 @@ region only contains such lines."
 
 
 (defun org-setup-comments-handling ()
 (defun org-setup-comments-handling ()
   (interactive)
   (interactive)
-  (org-set-local 'comment-use-syntax nil)
-  (org-set-local 'comment-start "# ")
-  (org-set-local 'comment-start-skip "^\\s-*#\\(?: \\|$\\)")
-  (org-set-local 'comment-insert-comment-function 'org-insert-comment)
-  (org-set-local 'comment-region-function 'org-comment-or-uncomment-region)
-  (org-set-local 'uncomment-region-function 'org-comment-or-uncomment-region))
+  (setq-local comment-use-syntax nil)
+  (setq-local comment-start "# ")
+  (setq-local comment-start-skip "^\\s-*#\\(?: \\|$\\)")
+  (setq-local comment-insert-comment-function 'org-insert-comment)
+  (setq-local comment-region-function 'org-comment-or-uncomment-region)
+  (setq-local uncomment-region-function 'org-comment-or-uncomment-region))
 
 
 (defun org-insert-comment ()
 (defun org-insert-comment ()
   "Insert an empty comment above current line.
   "Insert an empty comment above current line.
@@ -25052,9 +25018,8 @@ when non-nil, is a regexp matching keywords names."
 
 
 ;;; Imenu support
 ;;; Imenu support
 
 
-(defvar org-imenu-markers nil
+(defvar-local org-imenu-markers nil
   "All markers currently used by Imenu.")
   "All markers currently used by Imenu.")
-(make-variable-buffer-local 'org-imenu-markers)
 
 
 (defun org-imenu-new-marker (&optional pos)
 (defun org-imenu-new-marker (&optional pos)
   "Return a new marker for use by Imenu, and remember the marker."
   "Return a new marker for use by Imenu, and remember the marker."

+ 1 - 1
lisp/ox-odt.el

@@ -1441,7 +1441,7 @@ original parsed data.  INFO is a plist holding export options."
       ;; currently the zip command zips up the entire temp directory so
       ;; currently the zip command zips up the entire temp directory so
       ;; that any auto-generated files created under the hood ends up in
       ;; that any auto-generated files created under the hood ends up in
       ;; the resulting odt file.
       ;; the resulting odt file.
-      (set (make-local-variable 'backup-inhibited) t)
+      (setq-local backup-inhibited t)
 
 
       ;; Outline numbering is retained only upto LEVEL.
       ;; Outline numbering is retained only upto LEVEL.
       ;; To disable outline numbering pass a LEVEL of 0.
       ;; To disable outline numbering pass a LEVEL of 0.

+ 3 - 3
lisp/ox.el

@@ -1326,7 +1326,7 @@ inferior to file-local settings."
   ;; First install #+BIND variables since these must be set before
   ;; First install #+BIND variables since these must be set before
   ;; global options are read.
   ;; global options are read.
   (dolist (pair (org-export--list-bound-variables))
   (dolist (pair (org-export--list-bound-variables))
-    (org-set-local (car pair) (nth 1 pair)))
+    (set (make-local-variable (car pair)) (nth 1 pair)))
   ;; Get and prioritize export options...
   ;; Get and prioritize export options...
   (org-combine-plists
   (org-combine-plists
    ;; ... from global variables...
    ;; ... from global variables...
@@ -6106,8 +6106,8 @@ files or buffers, only the display.
 	'(:eval
 	'(:eval
 	  (format "  %-12s | %6s | %s" "Back-End" "Age" "Source")))
 	  (format "  %-12s | %6s | %s" "Back-End" "Age" "Source")))
   (org-add-hook 'post-command-hook 'org-export-stack-refresh nil t)
   (org-add-hook 'post-command-hook 'org-export-stack-refresh nil t)
-  (set (make-local-variable 'revert-buffer-function)
-       'org-export-stack-refresh))
+  (setq-local revert-buffer-function
+	      'org-export-stack-refresh))