瀏覽代碼

Merge branch 'master' of orgmode.org:org-mode

# Please enter a commit message to explain why this merge is necessary,
# especially if it merges an updated upstream into a topic branch.
#
# Lines starting with '#' will be ignored, and an empty message aborts
# the commit.
Bastien Guerry 12 年之前
父節點
當前提交
16d7b71762
共有 4 個文件被更改,包括 88 次插入56 次删除
  1. 51 43
      contrib/lisp/org-e-beamer.el
  2. 12 5
      default.mk
  3. 24 7
      lisp/Makefile
  4. 1 1
      targets.mk

+ 51 - 43
contrib/lisp/org-e-beamer.el

@@ -379,55 +379,63 @@ used as a communication channel."
   "Format HEADLINE as a frame.
 CONTENTS holds the contents of the headline.  INFO is a plist
 used as a communication channel."
-  (concat "\\begin{frame}"
-	  ;; Overlay specification, if any. If is surrounded by square
-	  ;; brackets, consider it as a default specification.
-	  (let ((action (org-element-property :beamer-act headline)))
-	    (cond
-	     ((not action) "")
-	     ((string-match "\\`\\[.*\\]\\'" action )
-	      (org-e-beamer--normalize-argument action 'defaction))
-	     (t (org-e-beamer--normalize-argument action 'action))))
-	  ;; Options, if any.
-	  (let ((options
-		 ;; Collect options from default value and headline's
-		 ;; properties.  Also add a label for links.
-		 (append
-		  (org-split-string org-e-beamer-frame-default-options
-				    ",")
-		  (let ((opt (org-element-property :beamer-opt headline)))
-		    (and opt (org-split-string
-			      ;; Remove square brackets if user
-			      ;; provided them.
-			      (and (string-match "^\\[?\\(.*\\)\\]?$" opt)
-				   (match-string 1 opt))
-			      ",")))
-		  (list
-		   (format "label=sec-%s"
-			   (mapconcat
-			    'number-to-string
-			    (org-export-get-headline-number headline info)
-			    "-"))))))
-	    ;; Change options list into a string. FRAGILEP is non-nil
-	    ;; when HEADLINE contains an element among
-	    ;; `org-e-beamer-verbatim-elements'.
-	    (let ((fragilep (org-element-map
-			     headline org-e-beamer-verbatim-elements 'identity
-			     info 'first-match)))
+  (let ((fragilep
+	 ;; FRAGILEP is non-nil when HEADLINE contains an element
+	 ;; among `org-e-beamer-verbatim-elements'.
+	 (org-element-map headline org-e-beamer-verbatim-elements 'identity
+			  info 'first-match)))
+    (concat "\\begin{frame}"
+	    ;; Overlay specification, if any. If is surrounded by square
+	    ;; brackets, consider it as a default specification.
+	    (let ((action (org-element-property :beamer-act headline)))
+	      (cond
+	       ((not action) "")
+	       ((string-match "\\`\\[.*\\]\\'" action )
+		(org-e-beamer--normalize-argument action 'defaction))
+	       (t (org-e-beamer--normalize-argument action 'action))))
+	    ;; Options, if any.
+	    (let ((options
+		   ;; Collect options from default value and headline's
+		   ;; properties.  Also add a label for links.
+		   (append
+		    (org-split-string org-e-beamer-frame-default-options
+				      ",")
+		    (let ((opt (org-element-property :beamer-opt headline)))
+		      (and opt (org-split-string
+				;; Remove square brackets if user
+				;; provided them.
+				(and (string-match "^\\[?\\(.*\\)\\]?$" opt)
+				     (match-string 1 opt))
+				",")))
+		    (list
+		     (format "label=sec-%s"
+			     (mapconcat
+			      'number-to-string
+			      (org-export-get-headline-number headline info)
+			      "-"))))))
+	      ;; Change options list into a string.
 	      (org-e-beamer--normalize-argument
 	       (mapconcat
 		'identity
 		(if (or (not fragilep) (member "fragile" options)) options
 		  (cons "fragile" options))
 		",")
-	       'option)))
-	  ;; Title.
-	  (format "{%s}"
-		  (org-export-data (org-element-property :title headline)
-				   info))
-	  "\n"
-	  contents
-	  "\\end{frame}"))
+	       'option))
+	    ;; Title.
+	    (format "{%s}"
+		    (org-export-data (org-element-property :title headline)
+				     info))
+	    "\n"
+	    ;; The following workaround is required in fragile frames
+	    ;; as Beamer will append "\par" to the beginning of the
+	    ;; contents.  So we need to make sure the command is
+	    ;; separated from the contents by at least one space.  If
+	    ;; it isn't, it will create "\parfirst-word" command and
+	    ;; remove the first word from the contents in the PDF
+	    ;; output.
+	    (if (not fragilep) contents
+	      (replace-regexp-in-string "\\`\n*" "\\& " contents))
+	    "\\end{frame}")))
 
 (defun org-e-beamer--format-block (headline contents info)
   "Format HEADLINE as a block.

+ 12 - 5
default.mk

@@ -73,6 +73,10 @@ MAKE_LOCAL_MK = $(BATCH) \
 # Emacs must be started in lisp directory
 BATCHL	= $(BATCH) \
 	  --eval '(add-to-list '"'"'load-path ".")'
+ELINTL	= $(BATCHL) \
+	  --eval '(load "elint")'
+ELINTF	= --eval '(elint-initialize t)' \
+	  --eval '(elint-file "./$$(el)")'
 
 # How to generate org-install.el
 MAKE_ORG_INSTALL = $(BATCHL) \
@@ -132,9 +136,12 @@ SUDO	= sudo
 # INSTALL_INFO = ginstall-info # Debian: avoid harmless warning message
 INSTALL_INFO = install-info
 
-# target variant for 'compile'
-# _COMPILE_ = single # one Emacs process per compilation
-# _COMPILE_ = source # ditto, but remove compiled file immediately
-# _COMPILE_ = slint1 # possibly elicit more warnings
-# _COMPILE_ = slint2 # possibly elicit even more warnings
+# target method for 'compile'
 _COMPILE_ = dirall
+#  (w/ slowdown compared to default variant)
+# _COMPILE_ = single #   4x one Emacs process per compilation
+# _COMPILE_ = source #   5x ditto, but remove compiled file immediately
+# _COMPILE_ = slint1 #   3x possibly elicit more warnings
+# _COMPILE_ = slint2 #   7x possibly elicit even more warnings
+# _COMPILE_ = slint3 #  25x run elint in a single Emacs process
+# _COMPILE_ = slint4 # 275x run elint in one Emacs process per source file

+ 24 - 7
lisp/Makefile

@@ -11,7 +11,9 @@ LISPF = $(filter-out $(LISPA),$(sort $(wildcard *.el)))
 LISPC = $(filter-out $(LISPN:%el=%elc),$(LISPF:%el=%elc))
 
 .PHONY:	all compile compile-dirty \
-	compile-single compile-source compile-slint1 compile-slint2 \
+	dirall source slint1 slint3 slint4 \
+	compile-single compile-source \
+	compile-slint1 compile-slint2 compile-slint3 compile-slint4 \
 	autoloads \
 	install clean cleanauto cleanall cleanelc clean-install
 
@@ -19,15 +21,30 @@ LISPC = $(filter-out $(LISPN:%el=%elc),$(LISPF:%el=%elc))
 all compile compile-dirty::	 autoloads
 	$(MAKE) compile-$(_COMPILE_)
 
-compile-dirall:
-	@$(ELCDIR)
+compile-dirall:	dirall
 compile-single: $(LISPC)
-compile-source: cleanelc
+compile-source:	source dirall
+compile-slint1:	dirall slint1
+compile-slint2:	source dirall slint1
+compile-slint3:	slint3 dirall
+compile-slint4:	slint4 dirall
+
+# internal
+dirall:
+	@$(info ==================== $@ ====================)
+	@$(ELCDIR)
+source: cleanelc
+	@$(info ==================== $@ ====================)
 	@$(foreach elc,$(LISPC),$(MAKE) $(elc) && $(RM) $(elc);)
-compile-slint1:	compile-dirall
+slint1:
+	@$(info ==================== $@ ====================)
 	@$(foreach elc,$(LISPC),$(RM) $(elc); $(MAKE) $(elc);)
-compile-slint2:
-	$(MAKE) compile-source compile-slint1
+slint3:
+	@$(info ==================== $@ ====================)
+	-@$(ELINTL) $(foreach el,$(LISPF),$(ELINTF))
+slint4:
+	@$(info ==================== $@ ====================)
+	-@$(foreach el,$(LISPF),$(ELINTL) $(ELINTF);)
 
 %.elc:	%.el
 	@$(info Compiling single $(abspath $<)...)

+ 1 - 1
targets.mk

@@ -35,7 +35,7 @@ CONF_BASE = EMACS DESTDIR
 CONF_DEST = lispdir infodir datadir testdir
 CONF_TEST = BTEST_PRE BTEST_POST BTEST_OB_LANGUAGES BTEST_EXTRA
 CONF_EXEC = CP MKDIR RM RMR FIND SUDO PDFTEX TEXI2PDF TEXI2HTML MAKEINFO INSTALL_INFO
-CONF_CALL = BATCH BATCHL ELCDIR BTEST MAKE_LOCAL_MK MAKE_ORG_INSTALL MAKE_ORG_VERSION
+CONF_CALL = BATCH BATCHL ELCDIR ELINTL ELINTF BTEST MAKE_LOCAL_MK MAKE_ORG_INSTALL MAKE_ORG_VERSION
 config-eol:: EOL = \#
 config-eol:: config-all
 config config-all::