------------------------------------------------------------ revno: 118036 committer: martin rudalics branch nick: trunk timestamp: Sat 2014-10-04 10:20:24 +0200 message: Add documentation for horizontal scroll bars and fix some minor issues. * buffer.c (scroll_bar_width, scroll_bar_height): Fix doc-strings. * window.c (Fset_window_scroll_bars): Fix doc-string. (Fwindow_scroll_bars): Have it return what the doc-string says. * window.el (window-full-height-p): Make it behave correctly for minibuffer window. (window-current-scroll-bars): Fix code. (fit-frame-to-buffer): Use window-scroll-bar-height instead of window-scroll-bars. * frame.el (frame-current-scroll-bars): Fix doc-string. * scroll-bar.el (toggle-horizontal-scroll-bar): New command. * frames.texi (Scroll Bars): Describe use of horizontal scroll bars. * display.texi (Scroll Bars): Add description of horizontal scroll bars and associated functions. * frames.texi (Layout Parameters): Add horizontal scroll bar entries. Remove paragraph on "combined fringe widths". * windows.texi (Window Sizes): Describe affects of horizontal scroll bars on window layout and sizes. Fix description of window-full-height-p. (Resizing Windows): Mention horizontal scroll bar. diff: === modified file 'doc/emacs/ChangeLog' --- doc/emacs/ChangeLog 2014-10-04 07:05:21 +0000 +++ doc/emacs/ChangeLog 2014-10-04 08:20:24 +0000 @@ -1,3 +1,8 @@ +2014-10-04 Martin Rudalics + + * frames.texi (Scroll Bars): Describe use of horizontal scroll + bars. + 2014-10-04 Glenn Morris * cmdargs.texi (Misc X): === modified file 'doc/emacs/frames.texi' --- doc/emacs/frames.texi 2014-10-03 09:18:49 +0000 +++ doc/emacs/frames.texi 2014-10-04 08:20:24 +0000 @@ -904,10 +904,11 @@ @section Scroll Bars @cindex Scroll Bar mode @cindex mode, Scroll Bar +@cindex Vertical Scroll Bar - On graphical displays, there is a @dfn{scroll bar} on the side of -each Emacs window. Clicking @kbd{Mouse-1} on the scroll bar's up and -down buttons scrolls the window by one line at a time. Clicking + On graphical displays, there is a @dfn{vertical scroll bar} on the +side of each Emacs window. Clicking @kbd{Mouse-1} on the scroll bar's +up and down buttons scrolls the window by one line at a time. Clicking @kbd{Mouse-1} above or below the scroll bar's inner box scrolls the window by nearly the entire height of the window, like @kbd{M-v} and @kbd{C-v} respectively (@pxref{Moving Point}). Dragging the inner box @@ -921,23 +922,23 @@ @findex scroll-bar-mode @findex toggle-scroll-bar - To toggle the use of scroll bars, type @kbd{M-x scroll-bar-mode}. -This command applies to all frames, including frames yet to be -created. To toggle scroll bars for just the selected frame, use the -command @kbd{M-x toggle-scroll-bar}. + To toggle the use of vertical scroll bars, type @kbd{M-x +scroll-bar-mode}. This command applies to all frames, including frames +yet to be created. To toggle vertical scroll bars for just the selected +frame, use the command @kbd{M-x toggle-scroll-bar}. @vindex scroll-bar-mode - To control the use of scroll bars at startup, customize the variable -@code{scroll-bar-mode}. Its value should be either @code{right} (put -scroll bars on the right side of windows), @code{left} (put them on -the left), or @code{nil} (disable scroll bars). By default, Emacs -puts scroll bars on the right if it was compiled with GTK+ support on -the X Window System, and on MS-Windows or Mac OS; Emacs puts scroll -bars on the left if compiled on the X Window System without GTK+ -support (following the old convention for X applications). + To control the use of vertical scroll bars at startup, customize the +variable @code{scroll-bar-mode}. Its value should be either +@code{right} (put scroll bars on the right side of windows), @code{left} +(put them on the left), or @code{nil} (disable vertical scroll bars). +By default, Emacs puts scroll bars on the right if it was compiled with +GTK+ support on the X Window System, and on MS-Windows or Mac OS; Emacs +puts scroll bars on the left if compiled on the X Window System without +GTK+ support (following the old convention for X applications). @vindex scroll-bar-width -@cindex width of the scroll bar +@cindex width of the vertical scroll bar You can also use the X resource @samp{verticalScrollBars} to enable or disable the scroll bars (@pxref{Resources}). To control the scroll bar width, change the @code{scroll-bar-width} frame parameter @@ -954,6 +955,39 @@ bottom when the end of the buffer is shown. You can not over-scroll when the entire buffer is visible. +@cindex Horizontal Scroll Bar +@cindex Horizontal Scroll Bar mode + On graphical displays with toolkit support, Emacs may also supply a +@dfn{horizontal scroll bar} on the bottom of each window. Clicking +@kbd{Mouse-1} on the that scroll bar's left and right buttons scrolls +the window horizontally by one column at a time. Clicking @kbd{Mouse-1} +on the left or right of the scroll bar's inner box scrolls the window by +four columns. Dragging the inner box scrolls the window continuously. + + Note that such horizontal scrolling can make the window's position of +point disappear on the left or the right. Typing a character to insert +text or moving point with a keyboard command will usually bring it back +into view. + +@findex horizontal-scroll-bar-mode + To toggle the use of horizontal scroll bars, type @kbd{M-x +horizontal-scroll-bar-mode}. This command applies to all frames, +including frames yet to be created. To toggle horizontal scroll bars +for just the selected frame, use the command @kbd{M-x +toggle-horizontal-scroll-bar}. + +@vindex horizontal-scroll-bar-mode + To control the use of horizontal scroll bars at startup, customize the +variable @code{horizontal-scroll-bar-mode}. + +@vindex scroll-bar-height +@cindex height of the horizontal scroll bar + You can also use the X resource @samp{horizontalScrollBars} to enable +or disable horizontal scroll bars (@pxref{Resources}). To control the +scroll bar height, change the @code{scroll-bar-height} frame parameter +(@pxref{Frame Parameters,,, elisp, The Emacs Lisp Reference Manual}). + + @node Drag and Drop @section Drag and Drop @cindex drag and drop === modified file 'doc/lispref/ChangeLog' --- doc/lispref/ChangeLog 2014-10-04 07:05:21 +0000 +++ doc/lispref/ChangeLog 2014-10-04 08:20:24 +0000 @@ -1,3 +1,14 @@ +2014-10-04 Martin Rudalics + + * display.texi (Scroll Bars): Add description of horizontal scroll + bars and associated functions. + * frames.texi (Layout Parameters): Add horizontal scroll bar + entries. Remove paragraph on "combined fringe widths". + * windows.texi (Window Sizes): Describe affects of horizontal + scroll bars on window layout and sizes. Fix description of + window-full-height-p. + (Resizing Windows): Mention horizontal scroll bar. + 2014-10-04 Glenn Morris * commands.texi (Generic Commands): Copyedits. === modified file 'doc/lispref/display.texi' --- doc/lispref/display.texi 2014-10-04 06:45:19 +0000 +++ doc/lispref/display.texi 2014-10-04 08:20:24 +0000 @@ -23,7 +23,7 @@ * Faces:: A face defines a graphics style for text characters: font, colors, etc. * Fringes:: Controlling window fringes. -* Scroll Bars:: Controlling vertical scroll bars. +* Scroll Bars:: Controlling scroll bars. * Window Dividers:: Separating windows visually. * Display Property:: Enabling special display features. * Images:: Displaying images in Emacs buffers. @@ -3866,101 +3866,163 @@ @code{overlay-arrow-string} or @code{overlay-arrow} fringe indicator is used. + @node Scroll Bars @section Scroll Bars @cindex scroll bars Normally the frame parameter @code{vertical-scroll-bars} controls -whether the windows in the frame have vertical scroll bars, and -whether they are on the left or right. The frame parameter -@code{scroll-bar-width} specifies how wide they are (@code{nil} -meaning the default). @xref{Layout Parameters}. +whether the windows in the frame have vertical scroll bars, and whether +they are on the left or right. The frame parameter +@code{scroll-bar-width} specifies how wide they are (@code{nil} meaning +the default). + + The frame parameter @code{horizontal-scroll-bars} controls whether +the windows in the frame have horizontal scroll bars. The frame +parameter @code{scroll-bar-height} specifies how high they are +(@code{nil} meaning the default). @xref{Layout Parameters}. + +@vindex horizontal-scroll-bars-available-p + Horizontal scroll bars are not available on all platforms. The +function @code{horizontal-scroll-bars-available-p} which takes no +argument returns non-@code{nil} if they are available on your system. + + The following three functions take as argument a live frame which +defaults to the selected one. @defun frame-current-scroll-bars &optional frame -This function reports the scroll bar type settings for frame -@var{frame}. The value is a cons cell -@code{(@var{vertical-type} .@: @var{horizontal-type})}, where -@var{vertical-type} is either @code{left}, @code{right}, or @code{nil} -(which means no scroll bar.) @var{horizontal-type} is meant to -specify the horizontal scroll bar type, but since they are not -implemented, it is always @code{nil}. -@end defun - -@vindex vertical-scroll-bar - You can enable or disable scroll bars for a particular buffer, -by setting the variable @code{vertical-scroll-bar}. This variable -automatically becomes buffer-local when set. The possible values are -@code{left}, @code{right}, @code{t}, which means to use the -frame's default, and @code{nil} for no scroll bar. - - You can also control this for individual windows. Call the function -@code{set-window-scroll-bars} to specify what to do for a specific window: - -@defun set-window-scroll-bars window width &optional vertical-type horizontal-type -This function sets the width and type of scroll bars for window -@var{window}. - -@var{width} specifies the scroll bar width in pixels (@code{nil} means -use the width specified for the frame). @var{vertical-type} specifies -whether to have a vertical scroll bar and, if so, where. The possible -values are @code{left}, @code{right} and @code{nil}, just like the -values of the @code{vertical-scroll-bars} frame parameter. - -The argument @var{horizontal-type} is meant to specify whether and -where to have horizontal scroll bars, but since they are not -implemented, it has no effect. If @var{window} is @code{nil}, the -selected window is used. -@end defun +This function reports the scroll bar types for frame @var{frame}. The +value is a cons cell @code{(@var{vertical-type} .@: +@var{horizontal-type})}, where @var{vertical-type} is either +@code{left}, @code{right}, or @code{nil} (which means no vertical scroll +bar.) @var{horizontal-type} is either @code{bottom} or @code{nil} +(which means no horizontal scroll bar). +@end defun + +@defun frame-scroll-bar-width &optional Lisp_Object &optional frame +This function returns the width of vertical scroll bars of @var{frame} +in pixels. +@end defun + +@defun frame-scroll-bar-height &optional Lisp_Object &optional frame +This function returns the height of horizontal scroll bars of +@var{frame} in pixels. +@end defun + +You can override the frame specific settings for individual windows by +using the following function: + +@defun set-window-scroll-bars window &optional width vertical-type height horizontal-type +This function sets the width and/or height and the types of scroll bars +for window @var{window}. + +@var{width} specifies the width of the vertical scroll bar in pixels +(@code{nil} means use the width specified for the frame). +@var{vertical-type} specifies whether to have a vertical scroll bar and, +if so, where. The possible values are @code{left}, @code{right}, +@code{t}, which means to use the frame's default, and @code{nil} for no +vertical scroll bar. + +@var{height} specifies the height of the horizontal scroll bar in pixels +(@code{nil} means use the height specified for the frame). +@var{horizontal-type} specifies whether to have a horizontal scroll bar. +The possible values are @code{bottom}, @code{t}, which means to use the +frame's default, and @code{nil} for no horizontal scroll bar. + +If @var{window} is @code{nil}, the selected window is used. +@end defun + +The following four functions take as argument a live window which +defaults to the selected one. @defun window-scroll-bars &optional window -Report the width and type of scroll bars specified for @var{window}. -If @var{window} is omitted or @code{nil}, the selected window is used. -The value is a list of the form @code{(@var{width} -@var{cols} @var{vertical-type} @var{horizontal-type})}. The value -@var{width} is the value that was specified for the width (which may -be @code{nil}); @var{cols} is the number of columns that the scroll -bar actually occupies. - -@var{horizontal-type} is not actually meaningful. +This function returns a list of the form @code{(@var{width} +@var{columns} @var{vertical-type} @var{height} @var{lines} +@var{horizontal-type})}. + +The value @var{width} is the value that was specified for the width of +the vertical scroll bar (which may be @code{nil}); @var{columns} is the +(possibly rounded) number of columns that the vertical scroll bar +actually occupies. + +The value @var{height} is the value that was specified for the height of +the horizontal scroll bar (which may be @code{nil}); @var{lines} is the +(possibly rounded) number of lines that the horizontally scroll bar +actually occupies. +@end defun + +@defun window-current-scroll-bars &optional window +This function reports the scroll bar type for window @var{window}. The +value is a cons cell @code{(@var{vertical-type} .@: +@var{horizontal-type})}. Unlike @code{window-scroll-bars}, this reports +the scroll bar type actually used, once frame defaults and +@code{scroll-bar-mode} are taken into account. @end defun @defun window-scroll-bar-width &optional window This function returns the width in pixels of @var{window}'s vertical -scrollbar. @var{window} must be a live window, and defaults to the -selected window. +scrollbar. +@end defun + +@defun window-scroll-bar-height &optional window +This function returns the height in pixels of @var{window}'s horizontal +scrollbar. @end defun If you don't specify these values for a window with @code{set-window-scroll-bars}, the buffer-local variables -@code{scroll-bar-mode} and @code{scroll-bar-width} in the buffer being -displayed control the window's vertical scroll bars. The function +@code{vertical-scroll-bar}, @code{horizontal-scroll-bar}, +@code{scroll-bar-width} and @code{scroll-bar-height} in the buffer being +displayed control the window's scroll bars. The function @code{set-window-buffer} examines these variables. If you change them -in a buffer that is already visible in a window, you can make the -window take note of the new values by calling @code{set-window-buffer} +in a buffer that is already visible in a window, you can make the window +take note of the new values by calling @code{set-window-buffer} specifying the same buffer that is already displayed. +You can control the appearance of scroll bars for a particular buffer by +setting the following variables which automatically become buffer-local +when set. + +@defvar vertical-scroll-bar +This variable specifies the location of the vertical scroll bar. The +possible values are @code{left}, @code{right}, @code{t}, which means to +use the frame's default, and @code{nil} for no scroll bar. +@end defvar + +@defvar horizontal-scroll-bar +This variable specifies the location of the horizontal scroll bar. The +possible values are @code{bottom}, @code{t}, which means to use the +frame's default, and @code{nil} for no scroll bar. +@end defvar + +@defvar scroll-bar-width +This variable specifies the width of the buffer's vertical scroll bars, +measured in pixels. A value of @code{nil} means to use the value +specified by the frame. +@end defvar + +@defvar scroll-bar-height +This variable specifies the height of the buffer's horizontal scroll +bar, measured in pixels. A value of @code{nil} means to use the value +specified by the frame. +@end defvar + +Finally you can toggle the display of scroll bars on all frames by +customizing the variables @code{scroll-bar-mode} and +@code{horizontal-scroll-bar-mode}. + @defopt scroll-bar-mode -This variable, always local in all buffers, controls whether and where -to put scroll bars in windows displaying the buffer. The possible values -are @code{nil} for no scroll bar, @code{left} to put a scroll bar on -the left, and @code{right} to put a scroll bar on the right. -@end defopt - -@defun window-current-scroll-bars &optional window -This function reports the scroll bar type for window @var{window}. -If @var{window} is omitted or @code{nil}, the selected window is used. -The value is a cons cell -@code{(@var{vertical-type} .@: @var{horizontal-type})}. Unlike -@code{window-scroll-bars}, this reports the scroll bar type actually -used, once frame defaults and @code{scroll-bar-mode} are taken into -account. -@end defun - -@defvar scroll-bar-width -This variable, always local in all buffers, specifies the width of the -buffer's scroll bars, measured in pixels. A value of @code{nil} means -to use the value specified by the frame. -@end defvar +This variable controls whether and where to put vertical scroll bars in +all frames. The possible values are @code{nil} for no scroll bars, +@code{left} to put scroll bars on the left and @code{right} to put +scroll bars on the right. +@end defopt + +@defopt horizontal-scroll-bar-mode +This variable controls whether to display horizontal scroll bars on all +frames. +@end defopt + @node Window Dividers @section Window Dividers === modified file 'doc/lispref/elisp.texi' --- doc/lispref/elisp.texi 2014-06-10 02:20:31 +0000 +++ doc/lispref/elisp.texi 2014-10-04 08:20:24 +0000 @@ -1343,7 +1343,7 @@ * Faces:: A face defines a graphics style for text characters: font, colors, etc. * Fringes:: Controlling window fringes. -* Scroll Bars:: Controlling vertical scroll bars. +* Scroll Bars:: Controlling scroll bars. * Window Dividers:: Separating windows visually. * Display Property:: Enabling special display features. * Images:: Displaying images in Emacs buffers. === modified file 'doc/lispref/frames.texi' --- doc/lispref/frames.texi 2014-10-04 07:05:21 +0000 +++ doc/lispref/frames.texi 2014-10-04 08:20:24 +0000 @@ -709,19 +709,21 @@ of the frame they should be on. The possible values are @code{left}, @code{right}, and @code{nil} for no scroll bars. -@ignore @vindex horizontal-scroll-bars, a frame parameter @item horizontal-scroll-bars -Whether the frame has scroll bars for horizontal scrolling -(non-@code{nil} means yes). Horizontal scroll bars are not currently -implemented. -@end ignore +Whether the frame has scroll bars for horizontal scrolling (@code{t} and +@code{bottom} mean yes, @code{nil} means no). @vindex scroll-bar-width, a frame parameter @item scroll-bar-width The width of vertical scroll bars, in pixels, or @code{nil} meaning to use the default width. +@vindex scroll-bar-height, a frame parameter +@item scroll-bar-height +The height of horizontal scroll bars, in pixels, or @code{nil} meaning +to use the default height. + @vindex left-fringe, a frame parameter @vindex right-fringe, a frame parameter @item left-fringe @@ -735,14 +737,6 @@ When using @code{set-frame-parameter}, passing a @code{nil} value imposes an actual default value of 8 pixels. -The combined fringe widths must add up to an integral number of -columns, so the actual default fringe widths for the frame, as -reported by @code{frame-parameter}, may be larger than what you -specify. Any extra width is distributed evenly between the left and -right fringe. However, you can force one fringe or the other to a -precise width by specifying that width as a negative integer. If both -widths are negative, only the left fringe gets the specified width. - @vindex right-divider-width, a frame parameter @item right-divider-width The width (thickness) reserved for the right divider (@pxref{Window === modified file 'doc/lispref/windows.texi' --- doc/lispref/windows.texi 2014-10-04 07:05:21 +0000 +++ doc/lispref/windows.texi 2014-10-04 08:20:24 +0000 @@ -394,13 +394,14 @@ @group ____________________________________________ |______________ Header Line ______________|RD| ^ - ^ |LS|LF|LM| |RM|RF|RS| | | + ^ |LS|LM|LF| |RF|RM|RS| | | | | | | | | | | | | | Window | | | | Text Area | | | | | Window Body | | | | | (Window Body) | | | | | Total Height | | | | | | | | | Height | | | | |<- Window Body Width ->| | | | | | v |__|__|__|_______________________|__|__|__| | | + |_________ Horizontal Scroll Bar _________| | | |_______________ Mode Line _______________|__| | |_____________ Bottom Divider _______________| v <---------- Window Total Width ------------> @@ -414,15 +415,15 @@ At the center of the window is the @dfn{text area}, or @dfn{body}, where the buffer text is displayed. The text area can be surrounded by a series of optional areas. On the left and right, from innermost to -outermost, these are the left and right margins, denoted by LM and RM in -the schematic (@pxref{Display Margins}); the left and right fringes, -denoted by LF and RF (@pxref{Fringes}); the left or right scroll bar, -only one of which is present at any time, denoted by LS and RS -(@pxref{Scroll Bars}); and the right divider, denoted by RD +outermost, these are the left and right fringes, denoted by LF and RF +(@pxref{Fringes}); the left and right margins, denoted by LM and RM in +the schematic (@pxref{Display Margins}); the left or right vertical +scroll bar, only one of which is present at any time, denoted by LS and +RS (@pxref{Scroll Bars}); and the right divider, denoted by RD (@pxref{Window Dividers}). At the top of the window is the header line -(@pxref{Header Lines}); at the bottom of the window is the mode line -(@pxref{Mode Line Format}) followed by the bottom divider (@pxref{Window -Dividers}). +(@pxref{Header Lines}). At the bottom of the window are the horizontal +scroll bar (@pxref{Scroll Bars}); the mode line (@pxref{Mode Line +Format}); and the bottom divider (@pxref{Window Dividers}). Emacs provides miscellaneous functions for finding the height and width of a window. The return value of many of these functions can be @@ -439,11 +440,8 @@ @cindex height of a window @cindex total height of a window The @dfn{total height} of a window is the number of lines comprising -the window's body, the header line, the mode line and the bottom divider -(if any). Note that the height of a frame is not the same as the height -of its root window (@pxref{Windows and Frames}), since a frame may also -contain an echo area, a menu bar, and a tool bar (@pxref{Size and -Position}). +the window's body, the header line, the horizontal scroll bar, the mode +line and the bottom divider (if any). @defun window-total-height &optional window round This function returns the total height, in lines, of the window @@ -457,8 +455,8 @@ parent window, the sum of the total heights of all its child windows internally equals the total height of their parent. This means that although two windows have the same pixel height, their internal total -heights may differ by one line. This means also, that if this window is -vertically combined and has a right sibling, the topmost row of that +heights may differ by one line. This means also, that if window is +vertically combined and has a next sibling, the topmost row of that sibling can be calculated as the sum of this window's topmost row and total height (@pxref{Coordinates and Windows}) @@ -490,11 +488,10 @@ equals the total width of their parent. This means that although two windows have the same pixel width, their internal total widths may differ by one column. This means also, that if this window is -horizontally combined and has a right sibling, the leftmost column of +horizontally combined and has a next sibling, the leftmost column of that sibling can be calculated as the sum of this window's leftmost -column and total width (@pxref{Coordinates and Windows}). The -optional argument @var{round} behaves as it does for -@code{window-total-height}. +column and total width (@pxref{Coordinates and Windows}). The optional +argument @var{round} behaves as it does for @code{window-total-height}. @end defun @defun window-total-size &optional window horizontal round @@ -517,9 +514,10 @@ This function returns the total height of window @var{window} in pixels. @var{window} must be a valid window and defaults to the selected one. -The return value includes mode and header line and a bottom divider, if -any. If @var{window} is an internal window, its pixel height is the -pixel height of the screen areas spanned by its children. +The return value includes mode and header line, a horizontal scroll bar +and a bottom divider, if any. If @var{window} is an internal window, +its pixel height is the pixel height of the screen areas spanned by its +children. @end defun @cindex window pixel height @@ -542,10 +540,12 @@ window has any adjacent windows. @defun window-full-height-p &optional window -This function returns non-@code{nil} if @var{window} has no other -window above or below it in its frame, i.e., its total height equals -the total height of the root window on that frame. If @var{window} is -omitted or @code{nil}, it defaults to the selected window. +This function returns non-@code{nil} if @var{window} has no other window +above or below it in its frame. More precisely, this means that the +total height of @var{window} equals the total height of the root window +on that frame. The minibuffer window does not count in this regard. If +@var{window} is omitted or @code{nil}, it defaults to the selected +window. @end defun @defun window-full-width-p &optional window @@ -559,7 +559,8 @@ @cindex body height of a window @cindex window body width The @dfn{body height} of a window is the height of its text area, which -does not include a mode or header line or a bottom divider. +does not include a mode or header line, a horizontal scroll bar, or a +bottom divider. @defun window-body-height &optional window pixelwise This function returns the height, in lines, of the body of window @@ -646,7 +647,8 @@ @defopt window-min-height This option specifies the minimum total height, in lines, of any window. Its value has to accommodate at least one text line as well as a mode -and header line and a bottom divider, if present. +and header line, a horizontal scroll bar and a bottom divider, if +present. @end defopt @defopt window-min-width @@ -685,10 +687,11 @@ The return value makes sure that all components of @var{window} remain fully visible if @var{window}'s size were actually set to it. With -@var{horizontal} @code{nil} it includes the mode and header line and the -bottom divider. With @var{horizontal} non-@code{nil} it includes the -fringes, a scroll bar, and a right divider, if present. It does not, -however, include the space reserved for the margins. +@var{horizontal} @code{nil} it includes the mode and header line, the +horizontal scroll bar and the bottom divider. With @var{horizontal} +non-@code{nil} it includes the fringes, a scroll bar, and a right +divider, if present. It does not, however, include the space reserved +for the margins. The optional argument @var{ignore}, if non-@code{nil}, means ignore restrictions imposed by fixed size windows, @code{window-min-height} or @@ -740,11 +743,11 @@ (@pxref{Window Sizes}). However, if the optional argument @var{ignore} is non-@code{nil}, this function ignores @code{window-min-height} and @code{window-min-width}, as well as @code{window-size-fixed}. Instead, -it considers the minimum-height window to be one consisting of a header, -a mode line and a bottom divider (if any), plus a text area one line -tall; and a minimum-width window as one consisting of fringes, margins, -a scroll bar and a right divider (if any), plus a text area two columns -wide. +it considers the minimum-height window to be one consisting of a header +and a mode line, a horizontal scrollbar and a bottom divider (if any), +plus a text area one line tall; and a minimum-width window as one +consisting of fringes, margins, a scroll bar and a right divider (if +any), plus a text area two columns wide. If the optional argument @var{pixelwise} is non-@code{nil}, @var{delta} is interpreted as pixels. === modified file 'etc/NEWS' --- etc/NEWS 2014-10-03 01:39:49 +0000 +++ etc/NEWS 2014-10-04 08:20:24 +0000 @@ -292,20 +292,28 @@ * Changes in Frames and Windows Code in Emacs 25.1 ++++ ** Emacs can now draw horizontal scroll bars on some platforms that -provide toolkit scroll bars, namely Gtk, Lucid, Motif and Windows. +provide toolkit scroll bars, namely Gtk+, Lucid, Motif and Windows. Horizontal scroll bars are turned off by default. *** New function `horizontal-scroll-bars-available-p' telling whether horizontal scroll bars are available on the underlying system. *** New mode `horizontal-scroll-bar-mode' to toggle horizontal scroll bars on all existing and future frames. +*** New function `toggle-horizontal-scroll-bar' to toggle horizontal + scroll bars on the selected frame. *** New frame parameters `horizontal-scroll-bars' and `scroll-bar-height' to set horizontal scroll bars and their height for individual frames and in `default-frame-alist'. -*** New function `frame-scroll-bar-height' to return the height of - horizontal scroll bars on a specific frame. +*** New functions `frame-scroll-bar-height' and + `window-scroll-bar-height' return the height of horizontal scroll + bars on a specific frame or window. *** `set-window-scroll-bars' now accepts five parameters where the last two specify height and type of the window's horizontal scroll bar. +*** `window-scroll-bars' now returns type and sizes of horizontal scroll + bars too. +*** New buffer-local variables `horizontal-scroll-bar' and + `scroll-bar-height'. ** The height of a frame's menu and tool bar are no more counted in the frame's text height. This means that the text height stands only for === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2014-10-04 07:27:10 +0000 +++ lisp/ChangeLog 2014-10-04 08:20:24 +0000 @@ -1,3 +1,13 @@ +2014-10-04 Martin Rudalics + + * window.el (window-full-height-p): Make it behave correctly for + minibuffer window. + (window-current-scroll-bars): Fix code. + (fit-frame-to-buffer): Use window-scroll-bar-height instead of + window-scroll-bars. + * frame.el (frame-current-scroll-bars): Fix doc-string. + * scroll-bar.el (toggle-horizontal-scroll-bar): New command. + 2014-10-04 Mark Oteiza (tiny change) * files.el (auto-mode-alist): Use sh-mode for .zsh files. (Bug#18488) === modified file 'lisp/frame.el' --- lisp/frame.el 2014-10-04 07:05:21 +0000 +++ lisp/frame.el 2014-10-04 08:20:24 +0000 @@ -1263,16 +1263,18 @@ (list (cons 'name name)))) (defun frame-current-scroll-bars (&optional frame) - "Return the current scroll-bar settings in frame FRAME. -Value is a cons (VERTICAL . HORIZ0NTAL) where VERTICAL specifies the -current location of the vertical scroll-bars (left, right, or nil), -and HORIZONTAL specifies the current location of the horizontal scroll -bars (top, bottom, or nil)." - (let ((vert (frame-parameter frame 'vertical-scroll-bars)) - (hor nil)) - (unless (memq vert '(left right nil)) - (setq vert default-frame-scroll-bars)) - (cons vert hor))) + "Return the current scroll-bar types for frame FRAME. +Value is a cons (VERTICAL . HORIZ0NTAL) where VERTICAL specifies +the current location of the vertical scroll-bars (`left', `right' +or nil), and HORIZONTAL specifies the current location of the +horizontal scroll bars (`bottom' or nil). FRAME must specify a +live frame and defaults to the selected one." + (let* ((frame (window-normalize-frame frame)) + (vertical (frame-parameter frame 'vertical-scroll-bars)) + (horizontal (frame-parameter frame 'horizontal-scroll-bars))) + (unless (memq vertical '(left right nil)) + (setq vertical default-frame-scroll-bars)) + (cons vertical (and horizontal 'bottom)))) (defun frame-monitor-attributes (&optional frame) "Return the attributes of the physical monitor dominating FRAME. === modified file 'lisp/scroll-bar.el' --- lisp/scroll-bar.el 2014-09-05 10:29:34 +0000 +++ lisp/scroll-bar.el 2014-10-04 08:20:24 +0000 @@ -79,7 +79,7 @@ (htype lines) ((frame-parameter nil 'horizontal-scroll-bars) ;; nil means it's a non-toolkit scroll bar (which is currently - ;; impossible), and its width in columns is 14 pixels rounded up. + ;; impossible), and its height in lines is 14 pixels rounded up. (ceiling (or (frame-parameter nil 'scroll-bar-height) 14) (frame-char-width))) (0)))) @@ -178,7 +178,7 @@ (defun toggle-scroll-bar (arg) "Toggle whether or not the selected frame has vertical scroll bars. -With arg, turn vertical scroll bars on if and only if arg is positive. +With ARG, turn vertical scroll bars on if and only if ARG is positive. The variable `scroll-bar-mode' controls which side the scroll bars are on when they are turned on; if it is nil, they go on the left." (interactive "P") @@ -193,6 +193,21 @@ (list (cons 'vertical-scroll-bars (if (> arg 0) (or scroll-bar-mode default-frame-scroll-bars)))))) + +(defun toggle-horizontal-scroll-bar (arg) + "Toggle whether or not the selected frame has horizontal scroll bars. +With ARG, turn vertical scroll bars on if and only if ARG is positive." + (interactive "P") + (if (null arg) + (setq arg + (if (cdr (assq 'horizontal-scroll-bars + (frame-parameters (selected-frame)))) + -1 1)) + (setq arg (prefix-numeric-value arg))) + (modify-frame-parameters + (selected-frame) + (list (cons 'horizontal-scroll-bars + (when (> arg 0) 'bottom))))) ;;;; Buffer navigation using the scroll bar. === modified file 'lisp/window.el' --- lisp/window.el 2014-09-22 19:20:45 +0000 +++ lisp/window.el 2014-10-04 08:20:24 +0000 @@ -1745,9 +1745,6 @@ (defalias 'window-height 'window-total-height) (defalias 'window-width 'window-body-width) -;; Eventually the following two should work pixelwise. - -;; See discussion in bug#4543. (defun window-full-height-p (&optional window) "Return t if WINDOW is as high as its containing frame. More precisely, return t if and only if the total height of @@ -1755,8 +1752,10 @@ frame. WINDOW must be a valid window and defaults to the selected one." (setq window (window-normalize-window window)) - (= (window-pixel-height window) - (window-pixel-height (frame-root-window window)))) + (if (window-minibuffer-p window) + (eq window (frame-root-window (window-frame window))) + (= (window-pixel-height window) + (window-pixel-height (frame-root-window window))))) (defun window-full-width-p (&optional window) "Return t if WINDOW is as wide as its containing frame. @@ -1780,28 +1779,26 @@ (window-body-height window pixelwise))) (defun window-current-scroll-bars (&optional window) - "Return the current scroll bar settings for WINDOW. + "Return the current scroll bar types for WINDOW. WINDOW must be a live window and defaults to the selected one. The return value is a cons cell (VERTICAL . HORIZONTAL) where VERTICAL specifies the current location of the vertical scroll -bars (`left', `right', or nil), and HORIZONTAL specifies the -current location of the horizontal scroll bars (`top', `bottom', -or nil). +bar (`left', `right' or nil), and HORIZONTAL specifies the +current location of the horizontal scroll bar (`bottom' or nil). Unlike `window-scroll-bars', this function reports the scroll bar type actually used, once frame defaults and `scroll-bar-mode' are taken into account." (setq window (window-normalize-window window t)) - (let ((vert (nth 2 (window-scroll-bars window))) - (hor nil)) - (when (or (eq vert t) (eq hor t)) - (let ((fcsb (frame-current-scroll-bars (window-frame window)))) - (if (eq vert t) - (setq vert (car fcsb))) - (if (eq hor t) - (setq hor (cdr fcsb))))) - (cons vert hor))) + (let ((vertical (nth 2 (window-scroll-bars window))) + (horizontal (nth 5 (window-scroll-bars window))) + (inherited (frame-current-scroll-bars (window-frame window)))) + (when (eq vertical t) + (setq vertical (car inherited))) + (when (eq horizontal t) + (setq horizontal (cdr inherited))) + (cons vertical (and horizontal 'bottom)))) (defun walk-windows (fun &optional minibuf all-frames) "Cycle through all live windows, calling FUN for each one. @@ -7176,7 +7173,7 @@ (height (+ (cdr value) (window-bottom-divider-width) - (nth 3 (window-scroll-bars))))) + (window-scroll-bar-height)))) ;; Don't change height or width when the window's size is fixed ;; in either direction or ONLY forbids it. (cond @@ -7335,7 +7332,7 @@ ;; height. Its width remains fixed. (setq height (+ (cdr (window-text-pixel-size nil nil t nil (frame-pixel-height) t)) - (nth 3 (window-scroll-bars window)) + (window-scroll-bar-height window) (window-bottom-divider-width))) ;; Round height. (unless pixelwise === modified file 'src/ChangeLog' --- src/ChangeLog 2014-10-03 16:05:12 +0000 +++ src/ChangeLog 2014-10-04 08:20:24 +0000 @@ -1,3 +1,10 @@ +2014-10-04 Martin Rudalics + + * buffer.c (scroll_bar_width, scroll_bar_height): Fix + doc-strings. + * window.c (Fset_window_scroll_bars): Fix doc-string. + (Fwindow_scroll_bars): Have it return what the doc-string says. + 2014-10-03 Eli Zaretskii * xdisp.c (move_it_by_lines): Call reseat_1 after moving the === modified file 'src/buffer.c' --- src/buffer.c 2014-10-01 03:28:16 +0000 +++ src/buffer.c 2014-10-04 08:20:24 +0000 @@ -5925,12 +5925,12 @@ DEFVAR_PER_BUFFER ("scroll-bar-width", &BVAR (current_buffer, scroll_bar_width), Qintegerp, - doc: /* Width of this buffer's scroll bars in pixels. + doc: /* Width of this buffer's vertical scroll bars in pixels. A value of nil means to use the scroll bar width from the window's frame. */); DEFVAR_PER_BUFFER ("scroll-bar-height", &BVAR (current_buffer, scroll_bar_height), Qintegerp, - doc: /* Height of this buffer's scroll bars in pixels. + doc: /* Height of this buffer's horizontal scroll bars in pixels. A value of nil means to use the scroll bar height from the window's frame. */); DEFVAR_PER_BUFFER ("vertical-scroll-bar", &BVAR (current_buffer, vertical_scroll_bar_type), === modified file 'src/window.c' --- src/window.c 2014-09-30 23:19:31 +0000 +++ src/window.c 2014-10-04 08:20:24 +0000 @@ -7002,16 +7002,17 @@ doc: /* Set width and type of scroll bars of window WINDOW. WINDOW must be a live window and defaults to the selected one. -Second parameter WIDTH specifies the pixel width for the scroll bar. +Second parameter WIDTH specifies the pixel width for the vertical scroll +bar. If WIDTH is nil, use the scroll-bar width of WINDOW's frame. Third parameter VERTICAL-TYPE specifies the type of the vertical scroll -bar: left, right, or nil. If WIDTH is nil, use the frame's scroll-bar -width. If VERTICAL-TYPE is t, use the frame's scroll-bar type. +bar: left, right, or nil. If VERTICAL-TYPE is t, this means use the +frame's scroll-bar type. -Fourth parameter HEIGHT specifies the pixel height for the scroll bar. -Fifth parameter HORIZONTAL-TYPE specifies the type of the vertical -scroll bar: nil, bottom, or t. If HEIGHT is nil, use the frame's -scroll-bar height. If HORIZONTAL-TYPE is t, use the frame's scroll-bar -type. +Fourth parameter HEIGHT specifies the pixel height for the horizontal +scroll bar. If HEIGHT is nil, use the scroll-bar height of WINDOW's +frame. Fifth parameter HORIZONTAL-TYPE specifies the type of the +horizontal scroll bar: nil, bottom, or t. If HORIZONTAL-TYPE is t, this +means to use the frame's horizontal scroll-bar type. Return t if scroll bars were actually changed and nil otherwise. */) (Lisp_Object window, Lisp_Object width, Lisp_Object vertical_type, @@ -7029,17 +7030,22 @@ doc: /* Get width and type of scroll bars of window WINDOW. WINDOW must be a live window and defaults to the selected one. -Value is a list of the form (WIDTH COLS VERTICAL-TYPE HEIGHT LINES -HORIZONTAL-TYPE). If WIDTH or HEIGHT is nil or TYPE is t, the window is -using the frame's corresponding value. */) +Value is a list of the form (WIDTH COLUMNS VERTICAL-TYPE HEIGHT LINES +HORIZONTAL-TYPE). If WIDTH or HEIGHT is nil or VERTICAL-TYPE or +HORIZONTAL-TYPE is t, the window is using the frame's corresponding +value. */) (Lisp_Object window) { struct window *w = decode_live_window (window); - return Fcons (make_number (WINDOW_SCROLL_BAR_AREA_WIDTH (w)), + return Fcons (((w->scroll_bar_width >= 0) + ? make_number (w->scroll_bar_width) + : Qnil), list5 (make_number (WINDOW_SCROLL_BAR_COLS (w)), w->vertical_scroll_bar_type, - make_number (WINDOW_SCROLL_BAR_AREA_HEIGHT (w)), + ((w->scroll_bar_height >= 0) + ? make_number (w->scroll_bar_height) + : Qnil), make_number (WINDOW_SCROLL_BAR_LINES (w)), w->horizontal_scroll_bar_type)); } ------------------------------------------------------------ revno: 118035 fixes bug: http://debbugs.gnu.org/18488 author: Mark Oteiza committer: Glenn Morris branch nick: trunk timestamp: Sat 2014-10-04 00:27:10 -0700 message: * lisp/files.el (auto-mode-alist): Use sh-mode for .zsh files. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2014-10-04 07:05:21 +0000 +++ lisp/ChangeLog 2014-10-04 07:27:10 +0000 @@ -1,3 +1,7 @@ +2014-10-04 Mark Oteiza (tiny change) + + * files.el (auto-mode-alist): Use sh-mode for .zsh files. (Bug#18488) + 2014-10-04 Glenn Morris * frame.el (frame-monitor-attributes) === modified file 'lisp/files.el' --- lisp/files.el 2014-10-01 17:23:42 +0000 +++ lisp/files.el 2014-10-04 07:27:10 +0000 @@ -2357,7 +2357,7 @@ ("[cC]hange[lL]og[-.][0-9]+\\'" . change-log-mode) ("\\$CHANGE_LOG\\$\\.TXT" . change-log-mode) ("\\.scm\\.[0-9]*\\'" . scheme-mode) - ("\\.[ck]?sh\\'\\|\\.shar\\'\\|/\\.z?profile\\'" . sh-mode) + ("\\.[ckz]?sh\\'\\|\\.shar\\'\\|/\\.z?profile\\'" . sh-mode) ("\\.bash\\'" . sh-mode) ("\\(/\\|\\`\\)\\.\\(bash_\\(profile\\|history\\|log\\(in\\|out\\)\\)\\|z?log\\(in\\|out\\)\\)\\'" . sh-mode) ("\\(/\\|\\`\\)\\.\\(shrc\\|[kz]shrc\\|bashrc\\|t?cshrc\\|esrc\\)\\'" . sh-mode) ------------------------------------------------------------ revno: 118034 fixes bug: http://debbugs.gnu.org/18465 committer: Glenn Morris branch nick: trunk timestamp: Sat 2014-10-04 00:22:51 -0700 message: * configure.ac: Silence warning with some old Xrandr.h. diff: === modified file 'ChangeLog' --- ChangeLog 2014-10-03 15:44:46 +0000 +++ ChangeLog 2014-10-04 07:22:51 +0000 @@ -1,3 +1,7 @@ +2014-10-04 Glenn Morris + + * configure.ac: Silence warning with some old Xrandr.h. (Bug#18465) + 2014-10-03 Paul Eggert * configure.ac: Port to strict POSIX shells on non-MinGW (Bug#18612). === modified file 'configure.ac' --- configure.ac 2014-10-03 15:44:46 +0000 +++ configure.ac 2014-10-04 07:22:51 +0000 @@ -3377,8 +3377,12 @@ EMACS_CHECK_MODULES([XRANDR], [$XRANDR_MODULES]) if test $HAVE_XRANDR = no; then # Test old way in case pkg-config doesn't have it (older machines). + # Include Xrender.h by hand to work around bug in older Xrandr.h + # (e.g. RHEL5) and silence (harmless) configure warning (bug#18465). AC_CHECK_HEADER(X11/extensions/Xrandr.h, - [AC_CHECK_LIB(Xrandr, XRRGetScreenResources, HAVE_XRANDR=yes)]) + [AC_CHECK_LIB(Xrandr, XRRGetScreenResources, HAVE_XRANDR=yes)], + [], [AC_INCLUDES_DEFAULT +#include ]) if test $HAVE_XRANDR = yes; then XRANDR_LIBS=-lXrandr fi ------------------------------------------------------------ revno: 118033 [merge] committer: Glenn Morris branch nick: trunk timestamp: Sat 2014-10-04 00:05:21 -0700 message: Merge from emacs-24; up to r117553 diff: === modified file 'doc/emacs/ChangeLog' --- doc/emacs/ChangeLog 2014-10-03 15:44:46 +0000 +++ doc/emacs/ChangeLog 2014-10-04 07:05:21 +0000 @@ -1,3 +1,13 @@ +2014-10-04 Glenn Morris + + * cmdargs.texi (Misc X): + * display.texi (Optional Mode Line): + * misc.texi (emacsclient Options): + * vc1-xtra.texi (VC Delete/Rename): Small fixes re @var usage. + + * killing.texi (Rectangles): Copyedits re rectangle-mark-mode. + (CUA Bindings): Mention rectangle-mark-mode. + 2014-10-03 Martin Rudalics * frames.texi (Frame Commands): === modified file 'doc/emacs/cmdargs.texi' --- doc/emacs/cmdargs.texi 2014-10-03 15:26:26 +0000 +++ doc/emacs/cmdargs.texi 2014-10-04 06:35:55 +0000 @@ -1106,8 +1106,8 @@ @c Enable horizontal scroll bars. Since horizontal scroll bars @c are not yet implemented, this actually does nothing. -@item --parent-id @var{ID} -Open Emacs as a client X window via the XEmbed protocol, with @var{ID} +@item --parent-id @var{id} +Open Emacs as a client X window via the XEmbed protocol, with @var{id} as the parent X window id. Currently, this option is mainly useful for developers. === modified file 'doc/emacs/display.texi' --- doc/emacs/display.texi 2014-04-29 14:45:24 +0000 +++ doc/emacs/display.texi 2014-10-04 06:35:55 +0000 @@ -1245,11 +1245,11 @@ following the buffer percentage like this: @example -@var{POS} of @var{SIZE} +@var{pos} of @var{size} @end example @noindent -Here @var{SIZE} is the human readable representation of the number of +Here @var{size} is the human readable representation of the number of characters in the buffer, which means that @samp{k} for 10^3, @samp{M} for 10^6, @samp{G} for 10^9, etc., are used to abbreviate. === modified file 'doc/emacs/killing.texi' --- doc/emacs/killing.texi 2014-04-29 14:45:24 +0000 +++ doc/emacs/killing.texi 2014-10-04 02:36:49 +0000 @@ -754,6 +754,10 @@ (@code{string-rectangle}). @item M-x string-insert-rectangle @key{RET} @var{string} @key{RET} Insert @var{string} on each line of the rectangle. +@item C-x @key{SPC} +Toggle Rectangle Mark mode (@code{rectangle-mark-mode}). +When this mode is active, the region-rectangle is highlighted and can +be shrunk/grown, and the standard kill and yank commands operate on it. @end table The rectangle operations fall into two classes: commands to erase or @@ -840,11 +844,13 @@ shifting the original text to the right. @findex rectangle-mark-mode -@cindex rectangular region - The command @kbd{C-x @key{SPC}} (@code{rectangle-mark-mode}) makes a -@dfn{rectangular region}. It is a new feature introduced in GNU Emacs -24.4, and most commands now are still unaware of it, but kill and yank -(@pxref{Killing}) do work on the rectangle. + The command @kbd{C-x @key{SPC}} (@code{rectangle-mark-mode}) toggles +whether the region-rectangle or the standard region is highlighted +(first activating the region if necessary). When this mode is enabled, +commands that resize the region (@kbd{C-f}, @kbd{C-n} etc.) do +so in a rectangular fashion, and killing and yanking operate on the +rectangle. @xref{Killing}. The mode persists only as long as the +region is active. @node CUA Bindings @section CUA Bindings @@ -887,7 +893,8 @@ of each line in the rectangle (on the same side as the cursor). You can use this rectangle support without activating CUA by calling the -@code{cua-rectangle-mark-mode} command. +@code{cua-rectangle-mark-mode} command. But see also the standard +@code{rectangle-mark-mode}. @xref{Rectangles}. With CUA you can easily copy text and rectangles into and out of registers by providing a one-digit numeric prefix to the kill, copy, === modified file 'doc/emacs/misc.texi' --- doc/emacs/misc.texi 2014-06-08 23:41:43 +0000 +++ doc/emacs/misc.texi 2014-10-04 07:05:21 +0000 @@ -1610,9 +1610,9 @@ edit the server buffers within Emacs, and they are @emph{not} killed when you type @kbd{C-x #} in them. -@item --parent-id @var{ID} +@item --parent-id @var{id} Open an @command{emacsclient} frame as a client frame in the parent X -window with id @var{ID}, via the XEmbed protocol. Currently, this +window with id @var{id}, via the XEmbed protocol. Currently, this option is mainly useful for developers. @item -q === modified file 'doc/emacs/vc1-xtra.texi' --- doc/emacs/vc1-xtra.texi 2014-01-01 07:43:34 +0000 +++ doc/emacs/vc1-xtra.texi 2014-10-04 06:35:55 +0000 @@ -113,7 +113,7 @@ schedule the deletion for committing. @item M-x vc-rename-file -Prompt for two file names, @var{VAR} and @var{OLD}, rename them in the +Prompt for two file names, @var{var} and @var{old}, rename them in the working tree, and schedule the renaming for committing. @end table === modified file 'doc/lispref/ChangeLog' --- doc/lispref/ChangeLog 2014-10-03 15:44:46 +0000 +++ doc/lispref/ChangeLog 2014-10-04 07:05:21 +0000 @@ -1,3 +1,18 @@ +2014-10-04 Glenn Morris + + * commands.texi (Generic Commands): Copyedits. + + * display.texi (Scroll Bars): + * modes.texi (Header Lines): Copyedits. + + * buffers.texi (Buffer List): + * display.texi (Image Descriptors, Defining Images): + * functions.texi (Core Advising Primitives): Small fixes re @var usage. + + * windows.texi (Window Sizes, Resizing Windows): Copyedits. + + * frames.texi (Multiple Terminals): Copyedits re multiple monitors. + 2014-10-03 Martin Rudalics * frames.texi (Size Parameters, Size and Position): Mention that === modified file 'doc/lispref/buffers.texi' --- doc/lispref/buffers.texi 2014-03-07 15:11:12 +0000 +++ doc/lispref/buffers.texi 2014-10-04 06:35:55 +0000 @@ -863,7 +863,7 @@ @defun last-buffer &optional buffer visible-ok frame This function returns the last buffer in @var{frame}'s buffer list other -than @var{BUFFER}. If @var{frame} is omitted or @code{nil}, it uses the +than @var{buffer}. If @var{frame} is omitted or @code{nil}, it uses the selected frame's buffer list. The argument @var{visible-ok} is handled as with @code{other-buffer}, === modified file 'doc/lispref/commands.texi' --- doc/lispref/commands.texi 2014-06-15 00:06:30 +0000 +++ doc/lispref/commands.texi 2014-10-04 07:05:21 +0000 @@ -589,31 +589,26 @@ @cindex alternatives, defining The macro @code{define-alternatives} can be used to define -@dfn{generic commands}. Generic commands are interactive functions -whose implementation can be selected among several alternatives, as a -matter of user preference. +@dfn{generic commands}. These are interactive functions whose +implementation can be selected from several alternatives, as a matter +of user preference. @defmac define-alternatives command &rest customizations -Define the new command `COMMAND'. - -The argument `COMMAND' should be a symbol. - -When a user runs @kbd{M-x COMMAND @key{RET}} for the first time, Emacs -will prompt for which alternative to use and record the selected -command as a custom variable. - -Running @kbd{C-u M-x COMMAND @key{RET}} prompts again for an -alternative and overwrites the previous choice. - -The variable @code{COMMAND-alternatives} contains an alist -(@pxref{Association Lists}) with alternative implementations of -`COMMAND'. @code{define-alternatives} does not have any effect until -this variable is set. - -If @var{customizations} is non-@var{nil}, it should be composed of -alternating @code{defcustom} keywords and values to add to the -declaration of @code{COMMAND-alternatives} (typically :group and -:version). +Define the new command @var{command}, a symbol. + +When a user runs @kbd{M-x @var{command} @key{RET}} for the first time, +Emacs prompts for which real form of the command to use, and records +the selection by way of a custom variable. Using a prefix argument +repeats this process of choosing an alternative. + +The variable @code{@var{command}-alternatives} should contain an alist +with alternative implementations of @var{command}. +Until this variable is set, @code{define-alternatives} has no effect. + +If @var{customizations} is non-@code{nil}, it should consist of +alternating @code{defcustom} keywords (typically @code{:group} and +@code{:version}) and values to add to the declaration of +@code{@var{command}-alternatives}. @end defmac @node Interactive Call === modified file 'doc/lispref/display.texi' --- doc/lispref/display.texi 2014-08-19 18:56:29 +0000 +++ doc/lispref/display.texi 2014-10-04 06:45:19 +0000 @@ -3925,9 +3925,9 @@ @end defun @defun window-scroll-bar-width &optional window -This function returns the width of @var{window}'s vertical scrollbar, -in pixels. @var{window} must be a live window. If @var{window} is -@code{nil} or omitted, it will be the selected window. +This function returns the width in pixels of @var{window}'s vertical +scrollbar. @var{window} must be a live window, and defaults to the +selected window. @end defun If you don't specify these values for a window with @@ -4503,7 +4503,7 @@ Each image descriptor has the form @code{(image . @var{props})}, where @var{props} is a property list of alternating keyword symbols -and values, including at least the pair @code{:type @var{TYPE}} which +and values, including at least the pair @code{:type @var{type}} that specifies the image type. The following is a list of properties that are meaningful for all @@ -4995,7 +4995,7 @@ Each specification in @var{specs} is a property list with contents depending on image type. All specifications must at least contain the properties @code{:type @var{type}} and either @w{@code{:file @var{file}}} -or @w{@code{:data @var{DATA}}}, where @var{type} is a symbol specifying +or @w{@code{:data @var{data}}}, where @var{type} is a symbol specifying the image type, e.g., @code{xbm}, @var{file} is the file to load the image from, and @var{data} is a string containing the actual image data. The first specification in the list whose @var{type} is supported, and === modified file 'doc/lispref/frames.texi' --- doc/lispref/frames.texi 2014-10-03 15:44:46 +0000 +++ doc/lispref/frames.texi 2014-10-04 07:05:21 +0000 @@ -314,57 +314,50 @@ @cindex multi-monitor On some ``multi-monitor'' setups, a single X display outputs to more -than one physical monitor. @code{display-monitor-attributes-list} and -@code{frame-monitor-attributes} can be used to obtain information -about each physical monitor on multi-monitor setups. +than one physical monitor. You can use the functions +@code{display-monitor-attributes-list} and @code{frame-monitor-attributes} +to obtain information about such setups. @defun display-monitor-attributes-list &optional display This function returns a list of physical monitor attributes on -@var{display}. Each element of the list is an association list, -representing the attributes of each physical monitor. The first -element corresponds to the primary monitor. - -Attributes for a physical monitor are: +@var{display}, which defaults to that of the selected frame. +Each element of the list is an association list, representing the +attributes of a physical monitor. The first element corresponds to +the primary monitor. The attribute keys and values are: @table @samp @item geometry -Position and size in pixels in the form of @samp{(X Y WIDTH HEIGHT)} +Position and size in pixels as @samp{(@var{x} @var{y} +@var{width} @var{height})}. @item workarea -Position and size of the workarea in pixels in the form of @samp{(X Y -WIDTH HEIGHT)} +Position and size of the work area in pixels as +@samp{(@var{x} @var{y} @var{width} @var{height})}. @item mm-size -Width and height in millimeters in the form of @samp{(WIDTH HEIGHT)} +Width and height in millimeters as @samp{(@var{width} @var{height})} @item frames -List of frames dominated by the physical monitor +List of frames that this physical monitor dominates (see below). @item name -Name of the physical monitor as a string +Name of the physical monitor as @var{string}. @end table -where X, Y, WIDTH, and HEIGHT are integers. @samp{name} is optional. - -A frame is dominated by a physical monitor when either the -largest area of the frame resides in the monitor, or the monitor -is the closest to the frame if the frame does not intersect any -physical monitors. Every non-tip frame (including invisible one) -in a graphical display is dominated by exactly one physical -monitor at a time, though it can span multiple (or no) physical -monitors. - -@var{display} defaults to the selected frame's display. +@var{x}, @var{y}, @var{width}, and @var{height} are integers. +@samp{name} may not be present. + +A frame is @dfn{dominated} by a physical monitor when either the +largest area of the frame resides in that monitor, or (if the frame +does not intersect any physical monitors) that monitor is the closest +to the frame. Every (non-tooltip) frame (whether visible or not) in a +graphical display is dominated by exactly one physical monitor at a +time, though the frame can span multiple (or no) physical monitors. @end defun @defun frame-monitor-attributes &optional frame This function returns the attributes of the physical monitor -dominating @var{frame}, which defaults to the selected frame. - -A frame is dominated by a physical monitor when either the -largest area of the frame resides in the monitor, or the monitor -is the closest to the frame if the frame does not intersect any -physical monitors. +dominating (see above) @var{frame}, which defaults to the selected frame. @end defun @node Frame Parameters === modified file 'doc/lispref/functions.texi' --- doc/lispref/functions.texi 2014-09-08 06:00:58 +0000 +++ doc/lispref/functions.texi 2014-10-04 07:05:21 +0000 @@ -1232,7 +1232,7 @@ @code{(local @var{symbol})}, where @var{symbol} is an expression which returns the variable name, then @var{function} will only be added in the current buffer. Finally, if you want to modify a lexical variable, you will -have to use @code{(var @var{VARIABLE})}. +have to use @code{(var @var{variable})}. Every function added with @code{add-function} can be accompanied by an association list of properties @var{props}. Currently only two of those === modified file 'doc/lispref/modes.texi' --- doc/lispref/modes.texi 2014-06-08 23:39:23 +0000 +++ doc/lispref/modes.texi 2014-10-04 06:45:19 +0000 @@ -2221,13 +2221,10 @@ It is normally @code{nil}, so that ordinary buffers have no header line. @end defvar -The function @code{window-header-line-height} returns the height of -the header line: - @defun window-header-line-height &optional window -Return the height of @var{window}'s header line, in pixels. -@var{window} must be a live window. If @var{window} is @code{nil} or -omitted, it will be the selected window. +This function returns the height in pixels of @var{window}'s header +line. @var{window} must be a live window, and defaults to the +selected window. @end defun A window that is just one line tall never displays a header line. A === modified file 'doc/lispref/windows.texi' --- doc/lispref/windows.texi 2014-04-29 15:16:07 +0000 +++ doc/lispref/windows.texi 2014-10-04 07:05:21 +0000 @@ -451,7 +451,7 @@ the selected window. If @var{window} is an internal window, the return value is the total height occupied by its descendant windows. - If a window's pixel height is not an integral multiple of its frame's + If a window's pixel height is not an integral multiple of its frame's default character height, the number of lines occupied by the window is rounded internally. This is done in a way such that, if the window is a parent window, the sum of the total heights of all its child windows @@ -462,13 +462,12 @@ sibling can be calculated as the sum of this window's topmost row and total height (@pxref{Coordinates and Windows}) - If the optional argument @var{round} equals @code{ceiling}, this + If the optional argument @var{round} is @code{ceiling}, this function returns the smallest integer larger than @var{window}'s pixel -height divided by the character height of @var{window}'s frame; if it is -@code{floor}, it returns the largest integer smaller than @var{window}'s -pixel height divided by the character height of @var{window}'s frame. -Any other value of @var{round} means to return the internal value of the -total height of @var{window}. +height divided by the character height of its frame; if it is +@code{floor}, it returns the largest integer smaller than said value; +with any other @var{round} it returns the internal value of +@var{windows}'s total height. @end defun @cindex window width @@ -484,7 +483,7 @@ the selected window. If @var{window} is internal, the return value is the total width occupied by its descendant windows. - If a window's pixel width is not an integral multiple of its frame's + If a window's pixel width is not an integral multiple of its frame's character width, the number of lines occupied by the window is rounded internally. This is done in a way such that, if the window is a parent window, the sum of the total widths of all its children internally @@ -493,15 +492,9 @@ differ by one column. This means also, that if this window is horizontally combined and has a right sibling, the leftmost column of that sibling can be calculated as the sum of this window's leftmost -column and total width (@pxref{Coordinates and Windows}). - -If the optional argument @var{round} is @code{ceiling}, this function -will return the smallest integer larger than @var{window}'s pixel width -divided by the character width of @var{window}'s frame; if it is -@code{floor}, it returns the largest integer smaller than @var{window}'s -pixel width divided by the character width of @var{window}'s frame. Any -other value of @var{round} means to return the internal total width of -@var{window}. +column and total width (@pxref{Coordinates and Windows}). The +optional argument @var{round} behaves as it does for +@code{window-total-height}. @end defun @defun window-total-size &optional window horizontal round @@ -510,8 +503,7 @@ omitted or @code{nil}, this is equivalent to calling @code{window-total-height} for @var{window}; otherwise it is equivalent to calling @code{window-total-width} for @var{window}. The optional -argument @code{ROUND} is handled as for @code{window-total-height} and -@code{window-total-width}. +argument @var{round} behaves as it does for @code{window-total-height}. @end defun The following two functions can be used to return the total size of a @@ -754,8 +746,8 @@ a scroll bar and a right divider (if any), plus a text area two columns wide. -If the optional argument @code{pixelwise} is non-@code{nil}, -@var{delta} will be interpreted as pixels. +If the optional argument @var{pixelwise} is non-@code{nil}, +@var{delta} is interpreted as pixels. @end defun @defun window-resize window delta &optional horizontal ignore pixelwise @@ -779,7 +771,7 @@ combination limits of the involved windows; in some cases, it may alter both edges. @xref{Recombining Windows}. To resize by moving only the bottom or right edge of a window, use the function -@code{adjust-window-trailing-edge}, below. +@code{adjust-window-trailing-edge}. @end defun @c The commands enlarge-window, enlarge-window-horizontally, @@ -792,8 +784,8 @@ moves the right edge by @var{delta} columns. If @var{window} is @code{nil}, it defaults to the selected window. -If the optional argument @code{pixelwise} is non-@code{nil}, -@var{delta} will be interpreted as pixels. +If the optional argument @var{pixelwise} is non-@code{nil}, +@var{delta} is interpreted as pixels. A positive @var{delta} moves the edge downwards or to the right; a negative @var{delta} moves it upwards or to the left. If the edge @@ -807,17 +799,16 @@ @cindex pixelwise, resizing windows @defopt window-resize-pixelwise -If the value of this option is non-@code{nil}, windows are resized in +If the value of this option is non-@code{nil}, Emacs resizes windows in units of pixels. This currently affects functions like @code{split-window} (@pxref{Splitting Windows}), @code{maximize-window}, @code{minimize-window}, @code{fit-window-to-buffer}, @code{shrink-window-if-larger-than-buffer} (all listed below) and @code{fit-frame-to-buffer} (@pxref{Size and Position}). -Note that when a frame's pixel size is not a multiple of the frame's -character size, at least one window may get resized pixelwise even if -this option is @code{nil}. The default value of this option is -@code{nil}. +Note that when a frame's pixel size is not a multiple of its character +size, at least one window may get resized pixelwise even if this +option is @code{nil}. The default value is @code{nil}. @end defopt The following commands resize windows in more specific ways. When === modified file 'doc/misc/ChangeLog' --- doc/misc/ChangeLog 2014-10-03 15:44:46 +0000 +++ doc/misc/ChangeLog 2014-10-04 07:05:21 +0000 @@ -1,3 +1,7 @@ +2014-10-04 Glenn Morris + + * vip.texi (Other Vi Commands): Markup fix. + 2014-10-03 Bastien Guerry * org.texi (Key bindings and useful functions): Fix typo. === modified file 'doc/misc/vip.texi' --- doc/misc/vip.texi 2014-06-10 02:20:31 +0000 +++ doc/misc/vip.texi 2014-10-04 07:05:21 +0000 @@ -1561,7 +1561,7 @@ @end example VIP uses a special local keymap to interpret key strokes you enter in vi -mode. The following keys are bound to @var{nil} in the keymap. Therefore, +mode. The following keys are bound to @code{nil} in the keymap. Therefore, these keys are interpreted by the global keymap of Emacs. We give below a short description of the functions bound to these keys in the global keymap. See GNU Emacs Manual for details. === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2014-10-04 04:03:49 +0000 +++ lisp/ChangeLog 2014-10-04 07:05:21 +0000 @@ -1,3 +1,8 @@ +2014-10-04 Glenn Morris + + * frame.el (frame-monitor-attributes) + (display-monitor-attributes-list): Doc fixes. + 2014-10-04 Stefan Monnier Merge trivially safe differences from standalone CC-mode. === modified file 'lisp/frame.el' --- lisp/frame.el 2014-10-03 15:44:46 +0000 +++ lisp/frame.el 2014-10-04 07:05:21 +0000 @@ -1276,7 +1276,7 @@ (defun frame-monitor-attributes (&optional frame) "Return the attributes of the physical monitor dominating FRAME. -If FRAME is omitted, describe the currently selected frame. +If FRAME is omitted or nil, describe the currently selected frame. A frame is dominated by a physical monitor when either the largest area of the frame resides in the monitor, or the monitor @@ -1554,16 +1554,15 @@ (defun display-monitor-attributes-list (&optional display) "Return a list of physical monitor attributes on DISPLAY. -Each element of the list represents the attributes of each -physical monitor. The first element corresponds to the primary -monitor. - -Attributes for a physical monitor is represented as an alist of -attribute keys and values as follows: - - geometry -- Position and size in pixels in the form of - (X Y WIDTH HEIGHT) - workarea -- Position and size of the workarea in pixels in the +If DISPLAY is omitted or nil, it defaults to the selected frame's display. +Each element of the list represents the attributes of a physical +monitor. The first element corresponds to the primary monitor. + +The attributes for a physical monitor are represented as an alist +of attribute keys and values as follows: + + geometry -- Position and size in pixels in the form of (X Y WIDTH HEIGHT) + workarea -- Position and size of the work area in pixels in the form of (X Y WIDTH HEIGHT) mm-size -- Width and height in millimeters in the form of (WIDTH HEIGHT) @@ -1576,11 +1575,10 @@ A frame is dominated by a physical monitor when either the largest area of the frame resides in the monitor, or the monitor is the closest to the frame if the frame does not intersect any -physical monitors. Every non-tip frame (including invisible one) +physical monitors. Every (non-tooltip) frame (including invisible ones) in a graphical display is dominated by exactly one physical monitor at a time, though it can span multiple (or no) physical -monitors. -If DISPLAY is omitted or nil, it defaults to the selected frame's display." +monitors." (let ((frame-type (framep-on-display display))) (cond ((eq frame-type 'x) ------------------------------------------------------------ revno: 118032 committer: Stefan Monnier branch nick: trunk timestamp: Sat 2014-10-04 00:03:49 -0400 message: Merge trivially safe differences from standalone CC-mode. * lisp/progmodes/cc-mode.el (c-initialize-cc-mode): Don't quote a symbol just to then pass it to `symbol-value'. (prog-mode): Provide fallback definition, if needed. * lisp/progmodes/cc-langs.el: Always load `cl'. Don't load `cl-lib'. Remove "cl-" prefix accordingly. * lisp/progmodes/cc-fonts.el (c-font-lock-invalid-string): Use integerp or characterp depending on the type of characters. (c-font-lock-enum-tail): Remove unused var `start'. * lisp/progmodes/cc-engine.el: Load CL at compile-time. (c-declare-lang-variables): Use mapcan. (c-append-to-state-cache): Remove unused var `ce+1'. (c-parse-state-state): Make buffer-local. (c-ssb-lit-begin): Remove unused var `pps-end-pos'. (c-just-after-func-arglist-p): Remove unused var `end'. * lisp/progmodes/cc-defs.el: Load cc-fix if delete-dups is undefined. (c-<-as-paren-syntax, c->-as-paren-syntax): Move definition earlier. (c-make-keywords-re): Use delete-dups. (c-get-current-file): Avoid file-name-base. * lisp/progmodes/cc-cmds.el (c-electric-lt-gt): Remove unused var `close-paren-inserted'. * lisp/progmodes/cc-awk.el (c-forward-sws): Remove unused declaration. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2014-10-04 02:35:28 +0000 +++ lisp/ChangeLog 2014-10-04 04:03:49 +0000 @@ -1,5 +1,28 @@ 2014-10-04 Stefan Monnier + Merge trivially safe differences from standalone CC-mode. + * progmodes/cc-mode.el (c-initialize-cc-mode): Don't quote a symbol + just to then pass it to `symbol-value'. + (prog-mode): Provide fallback definition, if needed. + * progmodes/cc-langs.el: Always load `cl'. Don't load `cl-lib'. + Remove "cl-" prefix accordingly. + * progmodes/cc-fonts.el (c-font-lock-invalid-string): Use integerp or + characterp depending on the type of characters. + (c-font-lock-enum-tail): Remove unused var `start'. + * progmodes/cc-engine.el: Load CL at compile-time. + (c-declare-lang-variables): Use mapcan. + (c-append-to-state-cache): Remove unused var `ce+1'. + (c-parse-state-state): Make buffer-local. + (c-ssb-lit-begin): Remove unused var `pps-end-pos'. + (c-just-after-func-arglist-p): Remove unused var `end'. + * progmodes/cc-defs.el: Load cc-fix if delete-dups is undefined. + (c-<-as-paren-syntax, c->-as-paren-syntax): Move definition earlier. + (c-make-keywords-re): Use delete-dups. + (c-get-current-file): Avoid file-name-base. + * progmodes/cc-cmds.el (c-electric-lt-gt): Remove unused var + `close-paren-inserted'. + * progmodes/cc-awk.el (c-forward-sws): Remove unused declaration. + * progmodes/python.el: Avoid building unneeded markers. (python-font-lock-keywords, python-indent-dedent-line) (python-fill-paren, python-shell-completion-complete-or-indent): === modified file 'lisp/progmodes/cc-awk.el' --- lisp/progmodes/cc-awk.el 2014-09-10 21:38:11 +0000 +++ lisp/progmodes/cc-awk.el 2014-10-04 04:03:49 +0000 @@ -61,7 +61,6 @@ (cc-bytecomp-defun c-backward-token-1) (cc-bytecomp-defun c-beginning-of-statement-1) (cc-bytecomp-defun c-backward-sws) -(cc-bytecomp-defun c-forward-sws) (defvar awk-mode-syntax-table (let ((st (make-syntax-table))) === modified file 'lisp/progmodes/cc-cmds.el' --- lisp/progmodes/cc-cmds.el 2014-02-17 18:16:32 +0000 +++ lisp/progmodes/cc-cmds.el 2014-10-04 04:03:49 +0000 @@ -1090,7 +1090,7 @@ (interactive "*P") (let ((c-echo-syntactic-information-p nil) - final-pos close-paren-inserted found-delim case-fold-search) + final-pos found-delim case-fold-search) (self-insert-command (prefix-numeric-value arg)) (setq final-pos (point)) === modified file 'lisp/progmodes/cc-defs.el' --- lisp/progmodes/cc-defs.el 2014-09-10 21:38:11 +0000 +++ lisp/progmodes/cc-defs.el 2014-10-04 04:03:49 +0000 @@ -86,6 +86,11 @@ font-lock-keywords))) (cc-load "cc-fix"))) +;; XEmacs 21.4 doesn't have `delete-dups'. +(eval-and-compile + (if (and (not (fboundp 'delete-dups)) + (not (featurep 'cc-fix))) + (cc-load "cc-fix"))) ;;; Variables also used at compile time. @@ -913,6 +918,12 @@ (cc-bytecomp-fboundp 'delete-extent) (cc-bytecomp-fboundp 'map-extents)))) +(defconst c-<-as-paren-syntax '(4 . ?>)) +(put 'c-<-as-paren-syntax 'syntax-table c-<-as-paren-syntax) + +(defconst c->-as-paren-syntax '(5 . ?<)) +(put 'c->-as-paren-syntax 'syntax-table c->-as-paren-syntax) + ;; `c-put-char-property' is complex enough in XEmacs and Emacs < 21 to ;; make it a function. (defalias 'c-put-char-property-fun @@ -1188,9 +1199,6 @@ (if (< (point) start) (goto-char (point-max))))) -(defconst c-<-as-paren-syntax '(4 . ?>)) -(put 'c-<-as-paren-syntax 'syntax-table c-<-as-paren-syntax) - (defsubst c-mark-<-as-paren (pos) ;; Mark the "<" character at POS as a template opener using the ;; `syntax-table' property via the `category' property. @@ -1201,9 +1209,6 @@ ;; cheaply. We use this, for instance, in `c-parse-state'. (c-put-char-property pos 'category 'c-<-as-paren-syntax)) -(defconst c->-as-paren-syntax '(5 . ?<)) -(put 'c->-as-paren-syntax 'syntax-table c->-as-paren-syntax) - (defsubst c-mark->-as-paren (pos) ;; Mark the ">" character at POS as an sexp list closer using the ;; syntax-table property. @@ -1419,8 +1424,8 @@ (defun c-make-keywords-re (adorn list &optional mode) "Make a regexp that matches all the strings the list. -Duplicates and nil elements in the list are removed. The resulting -regexp may contain zero or more submatch expressions. +Duplicates and nil elements in the list are removed. The +resulting regexp may contain zero or more submatch expressions. If ADORN is t there will be at least one submatch and the first surrounds the matched alternative, and the regexp will also not match @@ -1438,11 +1443,7 @@ when it's needed. The default is the current language taken from `c-buffer-is-cc-mode'." - (let (unique) - (dolist (elt list) - (unless (member elt unique) - (push elt unique))) - (setq list (delete nil unique))) + (setq list (delete nil (delete-dups list))) (if list (let (re) @@ -1638,13 +1639,13 @@ "support for the `syntax-table' text property " "is required."))) - ;; Find out if generic comment delimiters work. + ;; Find out if "\\s!" (generic comment delimiters) work. (c-safe (modify-syntax-entry ?x "!") (if (string-match "\\s!" "x") (setq list (cons 'gen-comment-delim list)))) - ;; Find out if generic string delimiters work. + ;; Find out if "\\s|" (generic string delimiters) work. (c-safe (modify-syntax-entry ?x "|") (if (string-match "\\s|" "x") @@ -1691,7 +1692,8 @@ (kill-buffer buf)) ;; See if `parse-partial-sexp' returns the eighth element. - (if (c-safe (>= (length (save-excursion (parse-partial-sexp (point) (point)))) + (if (c-safe (>= (length (save-excursion + (parse-partial-sexp (point) (point)))) 10)) (setq list (cons 'pps-extended-state list)) (error (concat @@ -1707,9 +1709,8 @@ '8-bit 8 bit syntax entry flags (XEmacs style). '1-bit 1 bit syntax entry flags (Emacs style). -'argumentative-bod-function beginning-of-defun passes ARG through - to a non-null beginning-of-defun-function. It is assumed - the end-of-defun does the same thing. +'argumentative-bod-function beginning-of-defun and end-of-defun pass + ARG through to beginning/end-of-defun-function. 'syntax-properties It works to override the syntax for specific characters in the buffer with the 'syntax-table property. It's always set - CC Mode no longer works in emacsen without @@ -1803,18 +1804,18 @@ (error "Unknown base mode `%s'" base-mode)) (put mode 'c-fallback-mode base-mode)) -(defvar c-lang-constants (make-vector 151 0) - "Obarray used as a cache to keep track of the language constants. -The constants stored are those defined by `c-lang-defconst' and the values -computed by `c-lang-const'. It's mostly used at compile time but it's not -stored in compiled files. +(defvar c-lang-constants (make-vector 151 0)) +;; Obarray used as a cache to keep track of the language constants. +;; The constants stored are those defined by `c-lang-defconst' and the values +;; computed by `c-lang-const'. It's mostly used at compile time but it's not +;; stored in compiled files. -The obarray contains all the language constants as symbols. The -value cells hold the evaluated values as alists where each car is -the mode name symbol and the corresponding cdr is the evaluated -value in that mode. The property lists hold the source definitions -and other miscellaneous data. The obarray might also contain -various other symbols, but those don't have any variable bindings.") +;; The obarray contains all the language constants as symbols. The +;; value cells hold the evaluated values as alists where each car is +;; the mode name symbol and the corresponding cdr is the evaluated +;; value in that mode. The property lists hold the source definitions +;; and other miscellaneous data. The obarray might also contain +;; various other symbols, but those don't have any variable bindings. (defvar c-lang-const-expansion nil) @@ -1831,7 +1832,9 @@ (t ;; Being evaluated interactively. (buffer-file-name))))) - (and file (file-name-base file)))) + (and file + (file-name-sans-extension + (file-name-nondirectory file))))) (defmacro c-lang-defconst-eval-immediately (form) "Can be used inside a VAL in `c-lang-defconst' to evaluate FORM === modified file 'lisp/progmodes/cc-engine.el' --- lisp/progmodes/cc-engine.el 2014-09-11 19:44:25 +0000 +++ lisp/progmodes/cc-engine.el 2014-10-04 04:03:49 +0000 @@ -147,18 +147,19 @@ (cc-require-when-compile 'cc-langs) (cc-require 'cc-vars) +(eval-when-compile (require 'cl)) + ;; Make declarations for all the `c-lang-defvar' variables in cc-langs. (defmacro c-declare-lang-variables () `(progn - ,@(apply 'nconc - (mapcar (lambda (init) - `(,(if (elt init 2) - `(defvar ,(car init) nil ,(elt init 2)) - `(defvar ,(car init) nil)) - (make-variable-buffer-local ',(car init)))) - (cdr c-lang-variable-inits))))) + ,@(mapcan (lambda (init) + `(,(if (elt init 2) + `(defvar ,(car init) nil ,(elt init 2)) + `(defvar ,(car init) nil)) + (make-variable-buffer-local ',(car init)))) + (cdr c-lang-variable-inits)))) (c-declare-lang-variables) @@ -826,7 +827,6 @@ ;; Record this as the first token if not starting inside it. (setq tok start)) - ;; The following while loop goes back one sexp (balanced parens, ;; etc. with contents, or symbol or suchlike) each iteration. This ;; movement is accomplished with a call to c-backward-sexp approx 170 @@ -2159,7 +2159,6 @@ ;; the middle of the desert, as long as it is not within a brace pair ;; recorded in `c-state-cache' or a paren/bracket pair. - ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; We maintain a simple cache of positions which aren't in a literal, so as to ;; speed up testing for non-literality. @@ -2780,7 +2779,7 @@ paren+1 ; Pos after some opening or closing paren. paren+1s ; A list of `paren+1's; used to determine a ; good-pos. - bra+1 ce+1 ; just after L/R bra-ces. + bra+1 ; just after L bra-ce. bra+1s ; list of OLD values of bra+1. mstart) ; start of a macro. @@ -3392,6 +3391,7 @@ (defvar c-parse-state-point nil) (defvar c-parse-state-state nil) +(make-variable-buffer-local 'c-parse-state-state) (defun c-record-parse-state-state () (setq c-parse-state-point (point)) (setq c-parse-state-state @@ -4166,7 +4166,7 @@ ;; Use `parse-partial-sexp' from a safe position down to the point to check ;; if it's outside comments and strings. (save-excursion - (let ((pos (point)) safe-pos state pps-end-pos) + (let ((pos (point)) safe-pos state) ;; Pick a safe position as close to the point as possible. ;; ;; FIXME: Consult `syntax-ppss' here if our cache doesn't give a good @@ -4860,14 +4860,17 @@ ;; it should return non-nil to ensure that the next search will find them. ;; ;; Such a spot is: - ;; o The first token after bob. - ;; o The first token after the end of submatch 1 in - ;; `c-decl-prefix-or-start-re' when that submatch matches. - ;; o The start of each `c-decl-prefix-or-start-re' match when - ;; submatch 1 doesn't match. - ;; o The first token after the end of each occurrence of the - ;; `c-type' text property with the value `c-decl-end', provided - ;; `c-type-decl-end-used' is set. + ;; o The first token after bob. + ;; o The first token after the end of submatch 1 in + ;; `c-decl-prefix-or-start-re' when that submatch matches. This + ;; submatch is typically a (L or R) brace or paren, a ;, or a ,. + ;; o The start of each `c-decl-prefix-or-start-re' match when + ;; submatch 1 doesn't match. This is, for example, the keyword + ;; "class" in Pike. + ;; o The start of a previously recognized declaration; "recognized" + ;; means that the last char of the previous token has a `c-type' + ;; text property with the value `c-decl-end'; this only holds + ;; when `c-type-decl-end-used' is set. ;; ;; Only a spot that match CFD-DECL-RE and whose face is in the ;; CFD-FACE-CHECKLIST list causes CFD-FUN to be called. The face @@ -4899,7 +4902,7 @@ ;; ;; This function might do hidden buffer changes. - (let ((cfd-start-pos (point)) + (let ((cfd-start-pos (point)) ; never changed (cfd-buffer-end (point-max)) ;; The end of the token preceding the decl spot last found ;; with `c-decl-prefix-or-start-re'. `cfd-limit' if there's @@ -4938,10 +4941,20 @@ ;; statement or declaration, which is earlier than the first ;; returned match. + ;; This `cond' moves back over any literals or macros. It has special + ;; handling for when the region being searched is entirely within a + ;; macro. It sets `cfd-continue-pos' (unless we've reached + ;; `cfd-limit'). (cond ;; First we need to move to a syntactically relevant position. ;; Begin by backing out of comment or string literals. + ;; + ;; This arm of the cond actually triggers if we're in a literal, + ;; and cfd-limit is at most at BONL. ((and + ;; This arm of the `and' moves backwards out of a literal when + ;; the face at point is a literal face. In this case, its value + ;; is always non-nil. (when (c-got-face-at (point) c-literal-faces) ;; Try to use the faces to back up to the start of the ;; literal. FIXME: What if the point is on a declaration @@ -4970,7 +4983,7 @@ (let ((range (c-literal-limits))) (if range (goto-char (car range))))) - (setq start-in-literal (point))) + (setq start-in-literal (point))) ; end of `and' arm. ;; The start is in a literal. If the limit is in the same ;; one we don't have to find a syntactic position etc. We @@ -4985,18 +4998,18 @@ (point) 'face nil cfd-limit)) (and (< (point) cfd-limit) (c-got-face-at (point) c-literal-faces)))) - (= (point) cfd-limit))) + (= (point) cfd-limit))) ; end of `cond' arm condition ;; Completely inside a literal. Set up variables to trig the ;; (< cfd-continue-pos cfd-start-pos) case below and it'll ;; find a suitable start position. - (setq cfd-continue-pos start-in-literal)) + (setq cfd-continue-pos start-in-literal)) ; end of `cond' arm ;; Check if the region might be completely inside a macro, to ;; optimize that like the completely-inside-literal above. ((save-excursion (and (= (forward-line 1) 0) - (bolp) ; forward-line has funny behavior at eob. + (bolp) ; forward-line has funny behavior at eob. (>= (point) cfd-limit) (progn (backward-char) (eq (char-before) ?\\)))) @@ -5006,6 +5019,8 @@ (setq cfd-continue-pos (1- cfd-start-pos) start-in-macro t)) + ;; The default arm of the `cond' moves back over any macro we're in + ;; and over any syntactic WS. It sets `c-find-decl-syntactic-pos'. (t ;; Back out of any macro so we don't miss any declaration ;; that could follow after it. @@ -5052,10 +5067,10 @@ (< (point) cfd-limit)) ;; Do an initial search now. In the bob case above it's ;; only done to search for a `c-decl-end' spot. - (c-find-decl-prefix-search)) + (c-find-decl-prefix-search)) ; sets cfd-continue-pos (setq c-find-decl-match-pos (and (< cfd-match-pos cfd-start-pos) - cfd-match-pos))))) + cfd-match-pos))))) ; end of `cond' ;; Advance `cfd-continue-pos' if it's before the start position. ;; The closest continue position that might have effect at or @@ -5114,7 +5129,7 @@ ;; `cfd-match-pos' so we can continue at the start position. ;; (Note that we don't get here if the first match is below ;; it.) - (goto-char cfd-start-pos))) + (goto-char cfd-start-pos))) ; end of `cond' ;; Delete found matches if they are before our new continue ;; position, so that `c-find-decl-prefix-search' won't back up @@ -5123,7 +5138,7 @@ (when (and cfd-re-match (< cfd-re-match cfd-continue-pos)) (setq cfd-re-match nil)) (when (and cfd-prop-match (< cfd-prop-match cfd-continue-pos)) - (setq cfd-prop-match nil))) + (setq cfd-prop-match nil))) ; end of `when' (if syntactic-pos ;; This is the normal case and we got a proper syntactic @@ -5144,9 +5159,10 @@ ;; good start position for the search, so do it. (c-find-decl-prefix-search))) - ;; Now loop. Round what? (ACM, 2006/7/5). We already got the first match. - + ;; Now loop, one decl spot per iteration. We already have the first + ;; match in `cfd-match-pos'. (while (progn + ;; Go foward over "false matches", one per iteration. (while (and (< cfd-match-pos cfd-limit) @@ -5187,10 +5203,10 @@ (goto-char cfd-continue-pos) t))) - (< (point) cfd-limit)) - (c-find-decl-prefix-search)) + (< (point) cfd-limit)) ; end of "false matches" condition + (c-find-decl-prefix-search)) ; end of "false matches" loop - (< (point) cfd-limit)) + (< (point) cfd-limit)) ; end of condition for "decl-spot" while (when (and (>= (point) cfd-start-pos) @@ -5218,7 +5234,7 @@ ;; The matched token was the last thing in the macro, ;; so the whole match is bogus. (setq cfd-macro-end 0) - nil)))) + nil)))) ; end of when condition (c-debug-put-decl-spot-faces cfd-match-pos (point)) (if (funcall cfd-fun cfd-match-pos (/= cfd-macro-end 0)) @@ -5531,8 +5547,6 @@ (when need-new-end (and (> new-end c-new-END) (setq c-new-END new-end)))))) - - (defun c-after-change-check-<>-operators (beg end) ;; This is called from `after-change-functions' when ;; c-recognize-<>-arglists' is set. It ensures that no "<" or ">" @@ -5867,7 +5881,6 @@ ;; Recursive part of `c-forward-<>-arglist'. ;; ;; This function might do hidden buffer changes. - (let ((start (point)) res pos tmp ;; Cover this so that any recorded found type ranges are ;; automatically lost if it turns out to not be an angle @@ -5993,7 +6006,6 @@ (c-keyword-member (c-keyword-sym (match-string 1)) 'c-<>-type-kwds))))))) - ;; It was an angle bracket arglist. (setq c-record-found-types subres) @@ -7100,36 +7112,35 @@ (catch 'at-decl-or-cast ;; CASE 1 - (when (> paren-depth 0) - ;; Encountered something inside parens that isn't matched by - ;; the `c-type-decl-*' regexps, so it's not a type decl - ;; expression. Try to skip out to the same paren depth to - ;; not confuse the cast check below. - (c-safe (goto-char (scan-lists (point) 1 paren-depth))) - ;; If we've found a specifier keyword then it's a - ;; declaration regardless. - (throw 'at-decl-or-cast (eq at-decl-or-cast t))) - - (setq at-decl-end - (looking-at (cond ((eq context '<>) "[,>]") - (context "[,\)]") - (t "[,;]")))) - - ;; Now we've collected info about various characteristics of - ;; the construct we're looking at. Below follows a decision - ;; tree based on that. It's ordered to check more certain - ;; signs before less certain ones. - - (if got-identifier - (progn - - ;; CASE 2 - (when (and (or at-type maybe-typeless) - (not (or got-prefix got-parens))) - ;; Got another identifier directly after the type, so it's a - ;; declaration. - (throw 'at-decl-or-cast t)) - + (when (> paren-depth 0) + ;; Encountered something inside parens that isn't matched by + ;; the `c-type-decl-*' regexps, so it's not a type decl + ;; expression. Try to skip out to the same paren depth to + ;; not confuse the cast check below. + (c-safe (goto-char (scan-lists (point) 1 paren-depth))) + ;; If we've found a specifier keyword then it's a + ;; declaration regardless. + (throw 'at-decl-or-cast (eq at-decl-or-cast t))) + + (setq at-decl-end + (looking-at (cond ((eq context '<>) "[,>]") + (context "[,\)]") + (t "[,;]")))) + + ;; Now we've collected info about various characteristics of + ;; the construct we're looking at. Below follows a decision + ;; tree based on that. It's ordered to check more certain + ;; signs before less certain ones. + + (if got-identifier + (progn + + ;; CASE 2 + (when (and (or at-type maybe-typeless) + (not (or got-prefix got-parens))) + ;; Got another identifier directly after the type, so it's a + ;; declaration. + (throw 'at-decl-or-cast t)) (when (and got-parens (not got-prefix) @@ -7151,9 +7162,9 @@ (c-fdoc-shift-type-backward))) ;; Found no identifier. - (if backup-at-type - (progn + (if backup-at-type + (progn ;; CASE 3 (when (= (point) start) @@ -7176,251 +7187,251 @@ (setq backup-if-not-cast t) (throw 'at-decl-or-cast t))) - ;; CASE 4 - (when (and got-suffix - (not got-prefix) - (not got-parens)) - ;; Got a plain list of identifiers followed by some suffix. - ;; If this isn't a cast then the last identifier probably is - ;; the declared one and we should back up to the previous - ;; type. - (setq backup-if-not-cast t) - (throw 'at-decl-or-cast t))) - - ;; CASE 5 - (when (eq at-type t) - ;; If the type is known we know that there can't be any - ;; identifier somewhere else, and it's only in declarations in - ;; e.g. function prototypes and in casts that the identifier may - ;; be left out. - (throw 'at-decl-or-cast t)) - - (when (= (point) start) - ;; Only got a single identifier (parsed as a type so far). - ;; CASE 6 - (if (and - ;; Check that the identifier isn't at the start of an - ;; expression. - at-decl-end - (cond - ((eq context 'decl) - ;; Inside an arglist that contains declarations. If K&R - ;; style declarations and parenthesis style initializers - ;; aren't allowed then the single identifier must be a - ;; type, else we require that it's known or found - ;; (primitive types are handled above). - (or (and (not c-recognize-knr-p) - (not c-recognize-paren-inits)) - (memq at-type '(known found)))) - ((eq context '<>) - ;; Inside a template arglist. Accept known and found - ;; types; other identifiers could just as well be - ;; constants in C++. - (memq at-type '(known found))))) - (throw 'at-decl-or-cast t) - ;; CASE 7 - ;; Can't be a valid declaration or cast, but if we've found a - ;; specifier it can't be anything else either, so treat it as - ;; an invalid/unfinished declaration or cast. - (throw 'at-decl-or-cast at-decl-or-cast)))) - - (if (and got-parens - (not got-prefix) - (not context) - (not (eq at-type t)) - (or backup-at-type - maybe-typeless - backup-maybe-typeless - (when c-recognize-typeless-decls - (or (not got-suffix) - (not (looking-at - c-after-suffixed-type-maybe-decl-key)))))) - ;; Got an empty paren pair and a preceding type that probably - ;; really is the identifier. Shift the type backwards to make - ;; the last one the identifier. This is analogous to the - ;; "backtracking" done inside the `c-type-decl-suffix-key' loop - ;; above. - ;; - ;; Exception: In addition to the conditions in that - ;; "backtracking" code, do not shift backward if we're not - ;; looking at either `c-after-suffixed-type-decl-key' or "[;,]". - ;; Since there's no preceding type, the shift would mean that - ;; the declaration is typeless. But if the regexp doesn't match - ;; then we will simply fall through in the tests below and not - ;; recognize it at all, so it's better to try it as an abstract - ;; declarator instead. - (c-fdoc-shift-type-backward) - - ;; Still no identifier. - ;; CASE 8 - (when (and got-prefix (or got-parens got-suffix)) - ;; Require `got-prefix' together with either `got-parens' or - ;; `got-suffix' to recognize it as an abstract declarator: - ;; `got-parens' only is probably an empty function call. - ;; `got-suffix' only can build an ordinary expression together - ;; with the preceding identifier which we've taken as a type. - ;; We could actually accept on `got-prefix' only, but that can - ;; easily occur temporarily while writing an expression so we - ;; avoid that case anyway. We could do a better job if we knew - ;; the point when the fontification was invoked. - (throw 'at-decl-or-cast t)) - - ;; CASE 9 - (when (and at-type - (not got-prefix) - (not got-parens) - got-suffix-after-parens - (eq (char-after got-suffix-after-parens) ?\()) - ;; Got a type, no declarator but a paren suffix. I.e. it's a - ;; normal function call after all (or perhaps a C++ style object - ;; instantiation expression). - (throw 'at-decl-or-cast nil)))) - - ;; CASE 10 - (when at-decl-or-cast - ;; By now we've located the type in the declaration that we know - ;; we're in. - (throw 'at-decl-or-cast t)) - - ;; CASE 11 - (when (and got-identifier - (not context) - (looking-at c-after-suffixed-type-decl-key) - (if (and got-parens + ;; CASE 4 + (when (and got-suffix (not got-prefix) - (not got-suffix) - (not (eq at-type t))) - ;; Shift the type backward in the case that there's a - ;; single identifier inside parens. That can only - ;; occur in K&R style function declarations so it's - ;; more likely that it really is a function call. - ;; Therefore we only do this after - ;; `c-after-suffixed-type-decl-key' has matched. - (progn (c-fdoc-shift-type-backward) t) - got-suffix-after-parens)) - ;; A declaration according to `c-after-suffixed-type-decl-key'. - (throw 'at-decl-or-cast t)) - - ;; CASE 12 - (when (and (or got-prefix (not got-parens)) - (memq at-type '(t known))) - ;; It's a declaration if a known type precedes it and it can't be a - ;; function call. - (throw 'at-decl-or-cast t)) - - ;; If we get here we can't tell if this is a type decl or a normal - ;; expression by looking at it alone. (That's under the assumption - ;; that normal expressions always can look like type decl expressions, - ;; which isn't really true but the cases where it doesn't hold are so - ;; uncommon (e.g. some placements of "const" in C++) it's not worth - ;; the effort to look for them.) + (not got-parens)) + ;; Got a plain list of identifiers followed by some suffix. + ;; If this isn't a cast then the last identifier probably is + ;; the declared one and we should back up to the previous + ;; type. + (setq backup-if-not-cast t) + (throw 'at-decl-or-cast t))) + + ;; CASE 5 + (when (eq at-type t) + ;; If the type is known we know that there can't be any + ;; identifier somewhere else, and it's only in declarations in + ;; e.g. function prototypes and in casts that the identifier may + ;; be left out. + (throw 'at-decl-or-cast t)) + + (when (= (point) start) + ;; Only got a single identifier (parsed as a type so far). + ;; CASE 6 + (if (and + ;; Check that the identifier isn't at the start of an + ;; expression. + at-decl-end + (cond + ((eq context 'decl) + ;; Inside an arglist that contains declarations. If K&R + ;; style declarations and parenthesis style initializers + ;; aren't allowed then the single identifier must be a + ;; type, else we require that it's known or found + ;; (primitive types are handled above). + (or (and (not c-recognize-knr-p) + (not c-recognize-paren-inits)) + (memq at-type '(known found)))) + ((eq context '<>) + ;; Inside a template arglist. Accept known and found + ;; types; other identifiers could just as well be + ;; constants in C++. + (memq at-type '(known found))))) + (throw 'at-decl-or-cast t) + ;; CASE 7 + ;; Can't be a valid declaration or cast, but if we've found a + ;; specifier it can't be anything else either, so treat it as + ;; an invalid/unfinished declaration or cast. + (throw 'at-decl-or-cast at-decl-or-cast)))) + + (if (and got-parens + (not got-prefix) + (not context) + (not (eq at-type t)) + (or backup-at-type + maybe-typeless + backup-maybe-typeless + (when c-recognize-typeless-decls + (or (not got-suffix) + (not (looking-at + c-after-suffixed-type-maybe-decl-key)))))) + ;; Got an empty paren pair and a preceding type that probably + ;; really is the identifier. Shift the type backwards to make + ;; the last one the identifier. This is analogous to the + ;; "backtracking" done inside the `c-type-decl-suffix-key' loop + ;; above. + ;; + ;; Exception: In addition to the conditions in that + ;; "backtracking" code, do not shift backward if we're not + ;; looking at either `c-after-suffixed-type-decl-key' or "[;,]". + ;; Since there's no preceding type, the shift would mean that + ;; the declaration is typeless. But if the regexp doesn't match + ;; then we will simply fall through in the tests below and not + ;; recognize it at all, so it's better to try it as an abstract + ;; declarator instead. + (c-fdoc-shift-type-backward) + + ;; Still no identifier. + ;; CASE 8 + (when (and got-prefix (or got-parens got-suffix)) + ;; Require `got-prefix' together with either `got-parens' or + ;; `got-suffix' to recognize it as an abstract declarator: + ;; `got-parens' only is probably an empty function call. + ;; `got-suffix' only can build an ordinary expression together + ;; with the preceding identifier which we've taken as a type. + ;; We could actually accept on `got-prefix' only, but that can + ;; easily occur temporarily while writing an expression so we + ;; avoid that case anyway. We could do a better job if we knew + ;; the point when the fontification was invoked. + (throw 'at-decl-or-cast t)) + + ;; CASE 9 + (when (and at-type + (not got-prefix) + (not got-parens) + got-suffix-after-parens + (eq (char-after got-suffix-after-parens) ?\()) + ;; Got a type, no declarator but a paren suffix. I.e. it's a + ;; normal function call after all (or perhaps a C++ style object + ;; instantiation expression). + (throw 'at-decl-or-cast nil)))) + + ;; CASE 10 + (when at-decl-or-cast + ;; By now we've located the type in the declaration that we know + ;; we're in. + (throw 'at-decl-or-cast t)) + + ;; CASE 11 + (when (and got-identifier + (not context) + (looking-at c-after-suffixed-type-decl-key) + (if (and got-parens + (not got-prefix) + (not got-suffix) + (not (eq at-type t))) + ;; Shift the type backward in the case that there's a + ;; single identifier inside parens. That can only + ;; occur in K&R style function declarations so it's + ;; more likely that it really is a function call. + ;; Therefore we only do this after + ;; `c-after-suffixed-type-decl-key' has matched. + (progn (c-fdoc-shift-type-backward) t) + got-suffix-after-parens)) + ;; A declaration according to `c-after-suffixed-type-decl-key'. + (throw 'at-decl-or-cast t)) + + ;; CASE 12 + (when (and (or got-prefix (not got-parens)) + (memq at-type '(t known))) + ;; It's a declaration if a known type precedes it and it can't be a + ;; function call. + (throw 'at-decl-or-cast t)) + + ;; If we get here we can't tell if this is a type decl or a normal + ;; expression by looking at it alone. (That's under the assumption + ;; that normal expressions always can look like type decl expressions, + ;; which isn't really true but the cases where it doesn't hold are so + ;; uncommon (e.g. some placements of "const" in C++) it's not worth + ;; the effort to look for them.) ;;; 2008-04-16: commented out the next form, to allow the function to recognize ;;; "foo (int bar)" in CC (an implicit type (in class foo) without a semicolon) ;;; as a(n almost complete) declaration, enabling it to be fontified. - ;; CASE 13 - ;; (unless (or at-decl-end (looking-at "=[^=]")) - ;; If this is a declaration it should end here or its initializer(*) - ;; should start here, so check for allowed separation tokens. Note - ;; that this rule doesn't work e.g. with a K&R arglist after a - ;; function header. - ;; - ;; *) Don't check for C++ style initializers using parens - ;; since those already have been matched as suffixes. - ;; - ;; If `at-decl-or-cast' is then we've found some other sign that - ;; it's a declaration or cast, so then it's probably an - ;; invalid/unfinished one. - ;; (throw 'at-decl-or-cast at-decl-or-cast)) - - ;; Below are tests that only should be applied when we're certain to - ;; not have parsed halfway through an expression. - - ;; CASE 14 - (when (memq at-type '(t known)) - ;; The expression starts with a known type so treat it as a - ;; declaration. - (throw 'at-decl-or-cast t)) - - ;; CASE 15 - (when (and (c-major-mode-is 'c++-mode) - ;; In C++ we check if the identifier is a known type, since - ;; (con|de)structors use the class name as identifier. - ;; We've always shifted over the identifier as a type and - ;; then backed up again in this case. - identifier-type - (or (memq identifier-type '(found known)) - (and (eq (char-after identifier-start) ?~) - ;; `at-type' probably won't be 'found for - ;; destructors since the "~" is then part of the - ;; type name being checked against the list of - ;; known types, so do a check without that - ;; operator. - (or (save-excursion - (goto-char (1+ identifier-start)) - (c-forward-syntactic-ws) - (c-with-syntax-table - c-identifier-syntax-table - (looking-at c-known-type-key))) - (save-excursion - (goto-char (1+ identifier-start)) - ;; We have already parsed the type earlier, - ;; so it'd be possible to cache the end - ;; position instead of redoing it here, but - ;; then we'd need to keep track of another - ;; position everywhere. - (c-check-type (point) - (progn (c-forward-type) - (point)))))))) - (throw 'at-decl-or-cast t)) - - (if got-identifier - (progn - ;; CASE 16 - (when (and got-prefix-before-parens - at-type - (or at-decl-end (looking-at "=[^=]")) - (not context) - (not got-suffix)) - ;; Got something like "foo * bar;". Since we're not inside an - ;; arglist it would be a meaningless expression because the - ;; result isn't used. We therefore choose to recognize it as - ;; a declaration. Do not allow a suffix since it could then - ;; be a function call. - (throw 'at-decl-or-cast t)) - - ;; CASE 17 - (when (and (or got-suffix-after-parens - (looking-at "=[^=]")) - (eq at-type 'found) - (not (eq context 'arglist))) - ;; Got something like "a (*b) (c);" or "a (b) = c;". It could - ;; be an odd expression or it could be a declaration. Treat - ;; it as a declaration if "a" has been used as a type - ;; somewhere else (if it's a known type we won't get here). - (throw 'at-decl-or-cast t))) - - ;; CASE 18 - (when (and context - (or got-prefix - (and (eq context 'decl) - (not c-recognize-paren-inits) - (or got-parens got-suffix)))) - ;; Got a type followed by an abstract declarator. If `got-prefix' - ;; is set it's something like "a *" without anything after it. If - ;; `got-parens' or `got-suffix' is set it's "a()", "a[]", "a()[]", - ;; or similar, which we accept only if the context rules out - ;; expressions. - (throw 'at-decl-or-cast t))) - - ;; If we had a complete symbol table here (which rules out - ;; `c-found-types') we should return t due to the disambiguation rule - ;; (in at least C++) that anything that can be parsed as a declaration - ;; is a declaration. Now we're being more defensive and prefer to - ;; highlight things like "foo (bar);" as a declaration only if we're - ;; inside an arglist that contains declarations. - ;; CASE 19 - (eq context 'decl)))) + ;; CASE 13 + ;; (unless (or at-decl-end (looking-at "=[^=]")) + ;; If this is a declaration it should end here or its initializer(*) + ;; should start here, so check for allowed separation tokens. Note + ;; that this rule doesn't work e.g. with a K&R arglist after a + ;; function header. + ;; + ;; *) Don't check for C++ style initializers using parens + ;; since those already have been matched as suffixes. + ;; + ;; If `at-decl-or-cast' is then we've found some other sign that + ;; it's a declaration or cast, so then it's probably an + ;; invalid/unfinished one. + ;; (throw 'at-decl-or-cast at-decl-or-cast)) + + ;; Below are tests that only should be applied when we're certain to + ;; not have parsed halfway through an expression. + + ;; CASE 14 + (when (memq at-type '(t known)) + ;; The expression starts with a known type so treat it as a + ;; declaration. + (throw 'at-decl-or-cast t)) + + ;; CASE 15 + (when (and (c-major-mode-is 'c++-mode) + ;; In C++ we check if the identifier is a known type, since + ;; (con|de)structors use the class name as identifier. + ;; We've always shifted over the identifier as a type and + ;; then backed up again in this case. + identifier-type + (or (memq identifier-type '(found known)) + (and (eq (char-after identifier-start) ?~) + ;; `at-type' probably won't be 'found for + ;; destructors since the "~" is then part of the + ;; type name being checked against the list of + ;; known types, so do a check without that + ;; operator. + (or (save-excursion + (goto-char (1+ identifier-start)) + (c-forward-syntactic-ws) + (c-with-syntax-table + c-identifier-syntax-table + (looking-at c-known-type-key))) + (save-excursion + (goto-char (1+ identifier-start)) + ;; We have already parsed the type earlier, + ;; so it'd be possible to cache the end + ;; position instead of redoing it here, but + ;; then we'd need to keep track of another + ;; position everywhere. + (c-check-type (point) + (progn (c-forward-type) + (point)))))))) + (throw 'at-decl-or-cast t)) + + (if got-identifier + (progn + ;; CASE 16 + (when (and got-prefix-before-parens + at-type + (or at-decl-end (looking-at "=[^=]")) + (not context) + (not got-suffix)) + ;; Got something like "foo * bar;". Since we're not inside an + ;; arglist it would be a meaningless expression because the + ;; result isn't used. We therefore choose to recognize it as + ;; a declaration. Do not allow a suffix since it could then + ;; be a function call. + (throw 'at-decl-or-cast t)) + + ;; CASE 17 + (when (and (or got-suffix-after-parens + (looking-at "=[^=]")) + (eq at-type 'found) + (not (eq context 'arglist))) + ;; Got something like "a (*b) (c);" or "a (b) = c;". It could + ;; be an odd expression or it could be a declaration. Treat + ;; it as a declaration if "a" has been used as a type + ;; somewhere else (if it's a known type we won't get here). + (throw 'at-decl-or-cast t))) + + ;; CASE 18 + (when (and context + (or got-prefix + (and (eq context 'decl) + (not c-recognize-paren-inits) + (or got-parens got-suffix)))) + ;; Got a type followed by an abstract declarator. If `got-prefix' + ;; is set it's something like "a *" without anything after it. If + ;; `got-parens' or `got-suffix' is set it's "a()", "a[]", "a()[]", + ;; or similar, which we accept only if the context rules out + ;; expressions. + (throw 'at-decl-or-cast t))) + + ;; If we had a complete symbol table here (which rules out + ;; `c-found-types') we should return t due to the disambiguation rule + ;; (in at least C++) that anything that can be parsed as a declaration + ;; is a declaration. Now we're being more defensive and prefer to + ;; highlight things like "foo (bar);" as a declaration only if we're + ;; inside an arglist that contains declarations. + ;; CASE 19 + (eq context 'decl)))) ;; The point is now after the type decl expression. @@ -7609,10 +7620,10 @@ (c-put-c-type-property (1- (point)) 'c-decl-end) t) - ;; It's an unfinished label. We consider the keyword enough - ;; to recognize it as a label, so that it gets fontified. - ;; Leave the point at the end of it, but don't put any - ;; `c-decl-end' marker. + ;; It's an unfinished label. We consider the keyword enough + ;; to recognize it as a label, so that it gets fontified. + ;; Leave the point at the end of it, but don't put any + ;; `c-decl-end' marker. (goto-char kwd-end) t)))) @@ -7797,69 +7808,69 @@ ;; ;; This function might do hidden buffer changes. - (let ((start (point)) - start-char - (c-promote-possible-types t) - lim - ;; Turn off recognition of angle bracket arglists while parsing - ;; types here since the protocol reference list might then be - ;; considered part of the preceding name or superclass-name. - c-recognize-<>-arglists) - - (if (or - (when (looking-at - (eval-when-compile - (c-make-keywords-re t - (append (c-lang-const c-protection-kwds objc) - '("@end")) - 'objc-mode))) - (goto-char (match-end 1)) - t) - - (and - (looking-at - (eval-when-compile - (c-make-keywords-re t - '("@interface" "@implementation" "@protocol") - 'objc-mode))) - - ;; Handle the name of the class itself. - (progn -; (c-forward-token-2) ; 2006/1/13 This doesn't move if the token's -; at EOB. - (goto-char (match-end 0)) - (setq lim (point)) - (c-skip-ws-forward) - (c-forward-type)) - - (catch 'break - ;; Look for ": superclass-name" or "( category-name )". - (when (looking-at "[:\(]") - (setq start-char (char-after)) + (let ((start (point)) + start-char + (c-promote-possible-types t) + lim + ;; Turn off recognition of angle bracket arglists while parsing + ;; types here since the protocol reference list might then be + ;; considered part of the preceding name or superclass-name. + c-recognize-<>-arglists) + + (if (or + (when (looking-at + (eval-when-compile + (c-make-keywords-re t + (append (c-lang-const c-protection-kwds objc) + '("@end")) + 'objc-mode))) + (goto-char (match-end 1)) + t) + + (and + (looking-at + (eval-when-compile + (c-make-keywords-re t + '("@interface" "@implementation" "@protocol") + 'objc-mode))) + + ;; Handle the name of the class itself. + (progn + ;; (c-forward-token-2) ; 2006/1/13 This doesn't move if the token's + ;; at EOB. + (goto-char (match-end 0)) + (setq lim (point)) + (c-skip-ws-forward) + (c-forward-type)) + + (catch 'break + ;; Look for ": superclass-name" or "( category-name )". + (when (looking-at "[:\(]") + (setq start-char (char-after)) + (forward-char) + (c-forward-syntactic-ws) + (unless (c-forward-type) (throw 'break nil)) + (when (eq start-char ?\() + (unless (eq (char-after) ?\)) (throw 'break nil)) (forward-char) - (c-forward-syntactic-ws) - (unless (c-forward-type) (throw 'break nil)) - (when (eq start-char ?\() - (unless (eq (char-after) ?\)) (throw 'break nil)) - (forward-char) - (c-forward-syntactic-ws))) - - ;; Look for a protocol reference list. - (if (eq (char-after) ?<) - (let ((c-recognize-<>-arglists t) - (c-parse-and-markup-<>-arglists t) - c-restricted-<>-arglists) - (c-forward-<>-arglist t)) - t)))) - - (progn - (c-backward-syntactic-ws lim) - (c-clear-c-type-property start (1- (point)) 'c-decl-end) - (c-put-c-type-property (1- (point)) 'c-decl-end) - t) - - (c-clear-c-type-property start (point) 'c-decl-end) - nil))) + (c-forward-syntactic-ws))) + + ;; Look for a protocol reference list. + (if (eq (char-after) ?<) + (let ((c-recognize-<>-arglists t) + (c-parse-and-markup-<>-arglists t) + c-restricted-<>-arglists) + (c-forward-<>-arglist t)) + t)))) + + (progn + (c-backward-syntactic-ws lim) + (c-clear-c-type-property start (1- (point)) 'c-decl-end) + (c-put-c-type-property (1- (point)) 'c-decl-end) + t) + + (c-clear-c-type-property start (point) 'c-decl-end) + nil))) (defun c-beginning-of-inheritance-list (&optional lim) ;; Go to the first non-whitespace after the colon that starts a @@ -7946,7 +7957,7 @@ ;; ;; This function might do hidden buffer changes. - (let ((beg (point)) end id-start) + (let ((beg (point)) id-start) (and (eq (c-beginning-of-statement-1 lim) 'same) @@ -8036,54 +8047,54 @@ (throw 'knr nil))) (if after-rparen - ;; We're inside a paren. Could it be our argument list....? - (if - (and - (progn - (goto-char after-rparen) - (unless (c-go-list-backward) (throw 'knr nil)) ; - ;; FIXME!!! What about macros between the parens? 2007/01/20 - (setq before-lparen (point))) - - ;; It can't be the arg list if next token is ; or { - (progn (goto-char after-rparen) - (c-forward-syntactic-ws) - (not (memq (char-after) '(?\; ?\{ ?\=)))) - - ;; Is the thing preceding the list an identifier (the - ;; function name), or a macro expansion? - (progn - (goto-char before-lparen) - (eq (c-backward-token-2) 0) - (or (eq (c-on-identifier) (point)) - (and (eq (char-after) ?\)) - (c-go-up-list-backward) - (eq (c-backward-token-2) 0) - (eq (c-on-identifier) (point))))) - - ;; Have we got a non-empty list of comma-separated - ;; identifiers? - (progn - (goto-char before-lparen) - (c-forward-token-2) ; to first token inside parens - (and - (c-on-identifier) - (c-forward-token-2) - (catch 'id-list - (while (eq (char-after) ?\,) - (c-forward-token-2) - (unless (c-on-identifier) (throw 'id-list nil)) - (c-forward-token-2)) - (eq (char-after) ?\)))))) - - ;; ...Yes. We've identified the function's argument list. - (throw 'knr - (progn (goto-char after-rparen) - (c-forward-syntactic-ws) - (point))) - - ;; ...No. The current parens aren't the function's arg list. - (goto-char before-lparen)) + ;; We're inside a paren. Could it be our argument list....? + (if + (and + (progn + (goto-char after-rparen) + (unless (c-go-list-backward) (throw 'knr nil)) ; + ;; FIXME!!! What about macros between the parens? 2007/01/20 + (setq before-lparen (point))) + + ;; It can't be the arg list if next token is ; or { + (progn (goto-char after-rparen) + (c-forward-syntactic-ws) + (not (memq (char-after) '(?\; ?\{ ?\=)))) + + ;; Is the thing preceding the list an identifier (the + ;; function name), or a macro expansion? + (progn + (goto-char before-lparen) + (eq (c-backward-token-2) 0) + (or (eq (c-on-identifier) (point)) + (and (eq (char-after) ?\)) + (c-go-up-list-backward) + (eq (c-backward-token-2) 0) + (eq (c-on-identifier) (point))))) + + ;; Have we got a non-empty list of comma-separated + ;; identifiers? + (progn + (goto-char before-lparen) + (c-forward-token-2) ; to first token inside parens + (and + (c-on-identifier) + (c-forward-token-2) + (catch 'id-list + (while (eq (char-after) ?\,) + (c-forward-token-2) + (unless (c-on-identifier) (throw 'id-list nil)) + (c-forward-token-2)) + (eq (char-after) ?\)))))) + + ;; ...Yes. We've identified the function's argument list. + (throw 'knr + (progn (goto-char after-rparen) + (c-forward-syntactic-ws) + (point))) + + ;; ...No. The current parens aren't the function's arg list. + (goto-char before-lparen)) (or (c-go-list-backward) ; backwards over [ .... ] (throw 'knr nil))))))))) @@ -8289,7 +8300,7 @@ (and (progn (while ; keep going back to "[;={"s until we either find - ; no more, or get to one which isn't an "operator =" + ; no more, or get to one which isn't an "operator =" (and (c-syntactic-re-search-forward "[;={]" start t t t) (eq (char-before) ?=) c-overloadable-operators-regexp @@ -8612,86 +8623,86 @@ (while (and (not bufpos) containing-sexp) (when paren-state - (if (consp (car paren-state)) - (setq lim (cdr (car paren-state)) - paren-state (cdr paren-state)) - (setq lim (car paren-state))) - (when paren-state - (setq next-containing (car paren-state) - paren-state (cdr paren-state)))) - (goto-char containing-sexp) - (if (c-looking-at-inexpr-block next-containing next-containing) - ;; We're in an in-expression block of some kind. Do not - ;; check nesting. We deliberately set the limit to the - ;; containing sexp, so that c-looking-at-inexpr-block - ;; doesn't check for an identifier before it. - (setq containing-sexp nil) - ;; see if the open brace is preceded by = or [...] in - ;; this statement, but watch out for operator= - (setq braceassignp 'dontknow) - (c-backward-token-2 1 t lim) - ;; Checks to do only on the first sexp before the brace. - (when (and c-opt-inexpr-brace-list-key - (eq (char-after) ?\[)) - ;; In Java, an initialization brace list may follow - ;; directly after "new Foo[]", so check for a "new" - ;; earlier. - (while (eq braceassignp 'dontknow) - (setq braceassignp - (cond ((/= (c-backward-token-2 1 t lim) 0) nil) - ((looking-at c-opt-inexpr-brace-list-key) t) - ((looking-at "\\sw\\|\\s_\\|[.[]") - ;; Carry on looking if this is an - ;; identifier (may contain "." in Java) - ;; or another "[]" sexp. - 'dontknow) - (t nil))))) - ;; Checks to do on all sexps before the brace, up to the - ;; beginning of the statement. + (if (consp (car paren-state)) + (setq lim (cdr (car paren-state)) + paren-state (cdr paren-state)) + (setq lim (car paren-state))) + (when paren-state + (setq next-containing (car paren-state) + paren-state (cdr paren-state)))) + (goto-char containing-sexp) + (if (c-looking-at-inexpr-block next-containing next-containing) + ;; We're in an in-expression block of some kind. Do not + ;; check nesting. We deliberately set the limit to the + ;; containing sexp, so that c-looking-at-inexpr-block + ;; doesn't check for an identifier before it. + (setq containing-sexp nil) + ;; see if the open brace is preceded by = or [...] in + ;; this statement, but watch out for operator= + (setq braceassignp 'dontknow) + (c-backward-token-2 1 t lim) + ;; Checks to do only on the first sexp before the brace. + (when (and c-opt-inexpr-brace-list-key + (eq (char-after) ?\[)) + ;; In Java, an initialization brace list may follow + ;; directly after "new Foo[]", so check for a "new" + ;; earlier. (while (eq braceassignp 'dontknow) - (cond ((eq (char-after) ?\;) - (setq braceassignp nil)) - ((and class-key - (looking-at class-key)) - (setq braceassignp nil)) - ((eq (char-after) ?=) - ;; We've seen a =, but must check earlier tokens so - ;; that it isn't something that should be ignored. - (setq braceassignp 'maybe) - (while (and (eq braceassignp 'maybe) - (zerop (c-backward-token-2 1 t lim))) - (setq braceassignp - (cond - ;; Check for operator = - ((and c-opt-op-identifier-prefix - (looking-at c-opt-op-identifier-prefix)) - nil) - ;; Check for `= in Pike. - ((and (c-major-mode-is 'pike-mode) - (or (eq (char-after) ?`) - ;; Special case for Pikes - ;; `[]=, since '[' is not in - ;; the punctuation class. - (and (eq (char-after) ?\[) - (eq (char-before) ?`)))) - nil) - ((looking-at "\\s.") 'maybe) - ;; make sure we're not in a C++ template - ;; argument assignment - ((and - (c-major-mode-is 'c++-mode) - (save-excursion - (let ((here (point)) - (pos< (progn - (skip-chars-backward "^<>") - (point)))) - (and (eq (char-before) ?<) - (not (c-crosses-statement-barrier-p - pos< here)) - (not (c-in-literal)) - )))) - nil) - (t t)))))) + (setq braceassignp + (cond ((/= (c-backward-token-2 1 t lim) 0) nil) + ((looking-at c-opt-inexpr-brace-list-key) t) + ((looking-at "\\sw\\|\\s_\\|[.[]") + ;; Carry on looking if this is an + ;; identifier (may contain "." in Java) + ;; or another "[]" sexp. + 'dontknow) + (t nil))))) + ;; Checks to do on all sexps before the brace, up to the + ;; beginning of the statement. + (while (eq braceassignp 'dontknow) + (cond ((eq (char-after) ?\;) + (setq braceassignp nil)) + ((and class-key + (looking-at class-key)) + (setq braceassignp nil)) + ((eq (char-after) ?=) + ;; We've seen a =, but must check earlier tokens so + ;; that it isn't something that should be ignored. + (setq braceassignp 'maybe) + (while (and (eq braceassignp 'maybe) + (zerop (c-backward-token-2 1 t lim))) + (setq braceassignp + (cond + ;; Check for operator = + ((and c-opt-op-identifier-prefix + (looking-at c-opt-op-identifier-prefix)) + nil) + ;; Check for `= in Pike. + ((and (c-major-mode-is 'pike-mode) + (or (eq (char-after) ?`) + ;; Special case for Pikes + ;; `[]=, since '[' is not in + ;; the punctuation class. + (and (eq (char-after) ?\[) + (eq (char-before) ?`)))) + nil) + ((looking-at "\\s.") 'maybe) + ;; make sure we're not in a C++ template + ;; argument assignment + ((and + (c-major-mode-is 'c++-mode) + (save-excursion + (let ((here (point)) + (pos< (progn + (skip-chars-backward "^<>") + (point)))) + (and (eq (char-before) ?<) + (not (c-crosses-statement-barrier-p + pos< here)) + (not (c-in-literal)) + )))) + nil) + (t t)))))) (if (and (eq braceassignp 'dontknow) (/= (c-backward-token-2 1 t lim) 0)) (setq braceassignp nil))) @@ -9214,7 +9225,7 @@ (max (c-point 'boi paren-pos) (point)))) (t (c-add-syntax 'defun-block-intro nil)))) - (c-add-syntax 'statement-block-intro nil))) + (c-add-syntax 'statement-block-intro nil))) (if (= paren-pos boi) ;; Always done if the open brace was at boi. The @@ -10327,7 +10338,6 @@ (c-add-syntax 'topmost-intro-cont (c-point 'boi))) )) - ;; (CASE 6 has been removed.) ;; CASE 7: line is an expression, not a statement. Most === modified file 'lisp/progmodes/cc-fonts.el' --- lisp/progmodes/cc-fonts.el 2014-09-10 21:38:11 +0000 +++ lisp/progmodes/cc-fonts.el 2014-10-04 04:03:49 +0000 @@ -366,39 +366,7 @@ (parse-sexp-lookup-properties (cc-eval-when-compile (boundp 'parse-sexp-lookup-properties)))) - - ;; (while (re-search-forward ,regexp limit t) - ;; (unless (progn - ;; (goto-char (match-beginning 0)) - ;; (c-skip-comments-and-strings limit)) - ;; (goto-char (match-end 0)) - ;; ,@(mapcar - ;; (lambda (highlight) - ;; (if (integerp (car highlight)) - ;; (progn - ;; (unless (eq (nth 2 highlight) t) - ;; (error - ;; "The override flag must currently be t in %s" - ;; highlight)) - ;; (when (nth 3 highlight) - ;; (error - ;; "The laxmatch flag may currently not be set in %s" - ;; highlight)) - ;; `(save-match-data - ;; (c-put-font-lock-face - ;; (match-beginning ,(car highlight)) - ;; (match-end ,(car highlight)) - ;; ,(elt highlight 1)))) - ;; (when (nth 3 highlight) - ;; (error "Match highlights currently not supported in %s" - ;; highlight)) - ;; `(progn - ;; ,(nth 1 highlight) - ;; (save-match-data ,(car highlight)) - ;; ,(nth 2 highlight)))) - ;; highlights))) ,(c-make-font-lock-search-form regexp highlights)) - nil))) (defun c-make-font-lock-BO-decl-search-function (regexp &rest highlights) @@ -716,7 +684,11 @@ (let ((start (1- (point)))) (save-excursion (and (eq (elt (parse-partial-sexp start (c-point 'eol)) 8) start) - (if (integerp c-multiline-string-start-char) + (if (if (eval-when-compile (integerp ?c)) + ;; Emacs + (integerp c-multiline-string-start-char) + ;; XEmacs + (characterp c-multiline-string-start-char)) ;; There's no multiline string start char before the ;; string, so newlines aren't allowed. (not (eq (char-before start) c-multiline-string-start-char)) @@ -1151,7 +1123,6 @@ (when list ;; Jump past any initializer or function prototype to see if ;; there's a ',' to continue at. - (cond ((eq id-face 'font-lock-function-name-face) ;; Skip a parenthesized initializer (C++) or a function ;; prototype. @@ -1219,8 +1190,8 @@ ;; o - nil, if not in an arglist at all. This includes the ;; parenthesized condition which follows "if", "while", etc. context - ;; The position of the next token after the closing paren of - ;; the last detected cast. + ;; A list of starting positions of possible type declarations, or of + ;; the typedef preceding one, if any. last-cast-end ;; The result from `c-forward-decl-or-cast-1'. decl-or-cast @@ -1564,9 +1535,7 @@ ;; Note that this function won't attempt to fontify beyond the end of the ;; current enum block, if any. (let* ((paren-state (c-parse-state)) - (encl-pos (c-most-enclosing-brace paren-state)) - (start (point)) - ) + (encl-pos (c-most-enclosing-brace paren-state))) (when (and encl-pos (eq (char-after encl-pos) ?\{) === modified file 'lisp/progmodes/cc-guess.el' --- lisp/progmodes/cc-guess.el 2014-06-26 07:13:13 +0000 +++ lisp/progmodes/cc-guess.el 2014-10-04 04:03:49 +0000 @@ -519,7 +519,8 @@ (goto-char (point-min)) (when (search-forward (concat "(" (symbol-name (car needs-markers)) - " ") nil t) + " ") + nil t) (move-end-of-line 1) (comment-dwim nil) (insert " Guessed value")) === modified file 'lisp/progmodes/cc-langs.el' --- lisp/progmodes/cc-langs.el 2014-09-10 21:38:11 +0000 +++ lisp/progmodes/cc-langs.el 2014-10-04 04:03:49 +0000 @@ -130,9 +130,7 @@ ;; This file is not always loaded. See note above. -;; Except it is always loaded - see bug#17463. -;;;(cc-external-require 'cl) -(require 'cl-lib) +(cc-external-require 'cl) ;;; Setup for the `c-lang-defvar' system. @@ -253,14 +251,14 @@ (unless xlate (setq xlate 'identity)) (c-with-syntax-table (c-lang-const c-mode-syntax-table) - (cl-delete-duplicates - (cl-mapcan (lambda (opgroup) + (delete-duplicates + (mapcan (lambda (opgroup) (when (if (symbolp (car opgroup)) (when (funcall opgroup-filter (car opgroup)) (setq opgroup (cdr opgroup)) t) t) - (cl-mapcan (lambda (op) + (mapcan (lambda (op) (when (funcall op-filter op) (let ((res (funcall xlate op))) (if (listp res) res (list res))))) @@ -301,7 +299,8 @@ ["Set Style..." c-set-style t] ["Show Current Style Name" (message "Style Name: %s" - c-indentation-style) t] + c-indentation-style) + t] ["Guess Style from this Buffer" c-guess-buffer-no-install t] ["Install the Last Guessed Style..." c-guess-install (and c-guess-guessed-offsets-alist @@ -1155,7 +1154,7 @@ (c-lang-defconst c-all-op-syntax-tokens ;; List of all tokens in the punctuation and parenthesis syntax ;; classes. - t (cl-delete-duplicates (append (c-lang-const c-other-op-syntax-tokens) + t (delete-duplicates (append (c-lang-const c-other-op-syntax-tokens) (c-lang-const c-operator-list)) :test 'string-equal)) @@ -1587,13 +1586,14 @@ (c-lang-defvar c-syntactic-eol (c-lang-const c-syntactic-eol)) -;;; Defun functions +;;; Defun handling. -;; The Emacs variables beginning-of-defun-function and -;; end-of-defun-function will be set so that commands like -;; `mark-defun' and `narrow-to-defun' work right. The key sequences -;; C-M-a and C-M-e are, however, bound directly to the CC Mode -;; functions, allowing optimization for large n. +;; The Emacs variables beginning-of-defun-function and end-of-defun-function +;; will be set so that commands like `mark-defun' and `narrow-to-defun' work +;; right. In older Emacsen, the key sequences C-M-a and C-M-e are, however, +;; bound directly to the CC Mode functions, allowing optimisation for large n. +;; From Emacs 23, this isn't necessary any more, since n is passed to the two +;; functions. (c-lang-defconst beginning-of-defun-function "Function to which beginning-of-defun-function will be set." t 'c-beginning-of-defun @@ -1754,7 +1754,7 @@ (c-lang-defconst c-type-start-kwds ;; All keywords that can start a type (i.e. are either a type prefix ;; or a complete type). - t (cl-delete-duplicates (append (c-lang-const c-primitive-type-kwds) + t (delete-duplicates (append (c-lang-const c-primitive-type-kwds) (c-lang-const c-type-prefix-kwds) (c-lang-const c-type-modifier-kwds)) :test 'string-equal)) @@ -1998,7 +1998,7 @@ ;; something is a type or just some sort of macro in front of the ;; declaration. They might be ambiguous with types or type ;; prefixes. - t (cl-delete-duplicates (append (c-lang-const c-class-decl-kwds) + t (delete-duplicates (append (c-lang-const c-class-decl-kwds) (c-lang-const c-brace-list-decl-kwds) (c-lang-const c-other-block-decl-kwds) (c-lang-const c-typedef-decl-kwds) @@ -2192,7 +2192,7 @@ pike '("array" "function" "int" "mapping" "multiset" "object" "program")) (c-lang-defconst c-paren-any-kwds - t (cl-delete-duplicates (append (c-lang-const c-paren-nontype-kwds) + t (delete-duplicates (append (c-lang-const c-paren-nontype-kwds) (c-lang-const c-paren-type-kwds)) :test 'string-equal)) @@ -2218,7 +2218,7 @@ (c-lang-defconst c-<>-sexp-kwds ;; All keywords that can be followed by an angle bracket sexp. - t (cl-delete-duplicates (append (c-lang-const c-<>-type-kwds) + t (delete-duplicates (append (c-lang-const c-<>-type-kwds) (c-lang-const c-<>-arglist-kwds)) :test 'string-equal)) @@ -2278,7 +2278,7 @@ (c-lang-defconst c-block-stmt-kwds ;; Union of `c-block-stmt-1-kwds' and `c-block-stmt-2-kwds'. - t (cl-delete-duplicates (append (c-lang-const c-block-stmt-1-kwds) + t (delete-duplicates (append (c-lang-const c-block-stmt-1-kwds) (c-lang-const c-block-stmt-2-kwds)) :test 'string-equal)) @@ -2382,7 +2382,7 @@ (c-lang-defconst c-expr-kwds ;; Keywords that can occur anywhere in expressions. Built from ;; `c-primary-expr-kwds' and all keyword operators in `c-operators'. - t (cl-delete-duplicates + t (delete-duplicates (append (c-lang-const c-primary-expr-kwds) (c-filter-ops (c-lang-const c-operator-list) t @@ -2486,7 +2486,7 @@ (c-lang-defconst c-keywords ;; All keywords as a list. - t (cl-delete-duplicates + t (delete-duplicates (c-lang-defconst-eval-immediately `(append ,@(mapcar (lambda (kwds-lang-const) `(c-lang-const ,kwds-lang-const)) @@ -2826,7 +2826,7 @@ (c-lang-defvar c-block-prefix-charset (c-lang-const c-block-prefix-charset)) (c-lang-defconst c-type-decl-prefix-key - "Regexp matching the declarator operators that might precede the + "Regexp matching any declarator operator that might precede the identifier in a declaration, e.g. the \"*\" in \"char *argv\". This regexp should match \"(\" if parentheses are valid in declarators. The end of the first submatch is taken as the end of the operator. @@ -3025,7 +3025,8 @@ expression is considered to be a type." t (or (consp (c-lang-const c-<>-type-kwds)) (consp (c-lang-const c-<>-arglist-kwds))) - java t) + java t) ; 2008-10-19. This is crude. The syntax for java + ; generics is not yet coded in CC Mode. (c-lang-defvar c-recognize-<>-arglists (c-lang-const c-recognize-<>-arglists)) (c-lang-defconst c-enums-contain-decls @@ -3249,7 +3250,7 @@ ;; `c-lang-const' will expand to the evaluated ;; constant immediately in `macroexpand-all' ;; below. - (cl-mapcan + (mapcan (lambda (init) `(current-var ',(car init) ,(car init) ,(macroexpand-all === modified file 'lisp/progmodes/cc-menus.el' --- lisp/progmodes/cc-menus.el 2014-01-01 07:43:34 +0000 +++ lisp/progmodes/cc-menus.el 2014-10-04 04:03:49 +0000 @@ -361,7 +361,7 @@ p (1+ p)) (cond ;; Is CHAR part of a objc token? - ((and (not inargvar) ; Ignore if CHAR is part of an argument variable. + ((and (not inargvar) ; Ignore if CHAR is part of an argument variable. (eq 0 betweenparen) ; Ignore if CHAR is in parentheses. (or (and (<= ?a char) (<= char ?z)) (and (<= ?A char) (<= char ?Z)) === modified file 'lisp/progmodes/cc-mode.el' --- lisp/progmodes/cc-mode.el 2014-09-10 21:38:11 +0000 +++ lisp/progmodes/cc-mode.el 2014-10-04 04:03:49 +0000 @@ -185,8 +185,7 @@ (run-hooks 'c-initialization-hook) ;; Fix obsolete variables. (if (boundp 'c-comment-continuation-stars) - (setq c-block-comment-prefix - (symbol-value 'c-comment-continuation-stars))) + (setq c-block-comment-prefix c-comment-continuation-stars)) (add-hook 'change-major-mode-hook 'c-leave-cc-mode-mode) (setq c-initialization-ok t) ;; Connect up with Emacs's electric-indent-mode, for >= Emacs 24.4 @@ -1322,6 +1321,7 @@ ;;;###autoload (add-to-list 'auto-mode-alist '("\\.i\\'" . c-mode)) ;;;###autoload (add-to-list 'auto-mode-alist '("\\.ii\\'" . c++-mode)) +(unless (fboundp 'prog-mode) (defalias 'prog-mode 'fundamental-mode)) ;;;###autoload (define-derived-mode c-mode prog-mode "C" === modified file 'lisp/progmodes/cc-vars.el' --- lisp/progmodes/cc-vars.el 2014-01-01 07:43:34 +0000 +++ lisp/progmodes/cc-vars.el 2014-10-04 04:03:49 +0000 @@ -275,13 +275,18 @@ "*Controls the operation of the TAB key. If t, hitting TAB always just indents the current line. If nil, hitting TAB indents the current line if point is at the left margin or in the -line's indentation, otherwise it calls `c-insert-tab-function' to -insert a `real' tab character. If some other value (neither nil nor t), -then inserts a tab only within literals (comments and strings), but -always reindents the line. - -Note: the variable `c-comment-only-line-offset' also controls the -indentation of lines containing only comments." +line's indentation, otherwise it inserts a `real' tab character \(see +note\). If some other value (not nil or t), then tab is inserted only +within literals \(comments and strings), but the line is always +reindented. + +Note: The value of `indent-tabs-mode' will determine whether a real +tab character will be inserted, or the equivalent number of spaces. +When inserting a tab, actually the function stored in the variable +`c-insert-tab-function' is called. + +Note: indentation of lines containing only comments is also controlled +by the `c-comment-only-line-offset' variable." :type '(radio (const :tag "TAB key always indents, never inserts TAB" t) (const :tag "TAB key indents in left margin, otherwise inserts TAB" nil) @@ -920,7 +925,7 @@ (defcustom c-special-indent-hook nil "*Hook for user defined special indentation adjustments. This hook gets called after each line is indented by the mode. It is only -called if `c-syntactic-indentation' is non-nil." +called when `c-syntactic-indentation' is non-nil." :type 'hook :group 'c) @@ -1689,7 +1694,8 @@ ;; It isn't possible to specify a doc-string without specifying an ;; initial value with `defvar', so the following two variables have been ;; given doc-strings by setting the property `variable-documentation' -;; directly. It's really good not to have an initial value for +;; directly. C-h v will read this documentation only for versions of GNU +;; Emacs from 22.1. It's really good not to have an initial value for ;; variables like these that always should be dynamically bound, so it's ;; worth the inconvenience. ------------------------------------------------------------ revno: 118031 committer: Stefan Monnier branch nick: trunk timestamp: Fri 2014-10-03 23:04:51 -0400 message: * lisp/erc/erc.el (erc-channel-receive-names): Silence compiler warning. (erc-format-@nick, erc-update-modes): Idem. diff: === modified file 'lisp/erc/ChangeLog' --- lisp/erc/ChangeLog 2014-10-03 11:08:37 +0000 +++ lisp/erc/ChangeLog 2014-10-04 03:04:51 +0000 @@ -1,3 +1,8 @@ +2014-10-04 Stefan Monnier + + * erc.el (erc-channel-receive-names): Silence compiler warning. + (erc-format-@nick, erc-update-modes): Idem. + 2014-10-03 Kelvin White * erc.el (erc-rename-buffers): Use defcustom instead of defvar for === modified file 'lisp/erc/erc.el' --- lisp/erc/erc.el 2014-10-03 11:08:37 +0000 +++ lisp/erc/erc.el 2014-10-04 03:04:51 +0000 @@ -4246,7 +4246,7 @@ (erc-propertize "+" 'help-echo "voice")) (t "")))) -(defun erc-format-@nick (&optional user channel-data) +(defun erc-format-@nick (&optional user _channel-data) "Format the nickname of USER showing if USER has a voice, is an operator, half-op, admin or owner. Owners have \"~\", admins have \"&\", operators have \"@\" and users with voice have \"+\" as a @@ -4770,22 +4770,24 @@ (hop-ch (cdr (assq ?h prefix))) (adm-ch (cdr (assq ?a prefix))) (own-ch (cdr (assq ?q prefix))) - names name op voice halfop admin owner) - (setq names (delete "" (split-string names-string))) + (names (delete "" (split-string names-string))) + name op voice halfop admin owner) (let ((erc-channel-members-changed-hook nil)) (dolist (item names) - (let ((updatep t)) + (let ((updatep t) + (ch (aref item 0))) (setq name item op 'off voice 'off halfop 'off admin 'off owner 'off) - (if (rassq (elt item 0) prefix) + (if (rassq ch prefix) (if (= (length item) 1) (setq updatep nil) (setq name (substring item 1)) - (setf (pcase (aref item 0) + (setf (pcase ch ((pred (eq voice-ch)) voice) ((pred (eq hop-ch)) halfop) ((pred (eq op-ch)) op) ((pred (eq adm-ch)) admin) - ((pred (eq own-ch)) owner)) + ((pred (eq own-ch)) owner) + (_ (error "Unknown prefix char `%S'" ch) voice)) 'on))) (when updatep (puthash (erc-downcase name) t @@ -5086,7 +5088,7 @@ (list add-modes remove-modes arg-modes)) nil)) -(defun erc-update-modes (tgt mode-string &optional nick host login) +(defun erc-update-modes (tgt mode-string &optional _nick _host _login) "Update the mode information for TGT, provided as MODE-STRING. Optional arguments: NICK, HOST and LOGIN - the attributes of the person who changed the modes." ------------------------------------------------------------ revno: 118030 committer: Stefan Monnier branch nick: trunk timestamp: Fri 2014-10-03 22:35:28 -0400 message: * lisp/progmodes/python.el: Avoid building unneeded markers. (python-font-lock-keywords, python-indent-dedent-line) (python-fill-paren, python-shell-completion-complete-or-indent): Prefer point over point-marker. (inferior-python-mode): Remove redundant completion settings. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2014-10-03 16:07:31 +0000 +++ lisp/ChangeLog 2014-10-04 02:35:28 +0000 @@ -1,3 +1,11 @@ +2014-10-04 Stefan Monnier + + * progmodes/python.el: Avoid building unneeded markers. + (python-font-lock-keywords, python-indent-dedent-line) + (python-fill-paren, python-shell-completion-complete-or-indent): + Prefer point over point-marker. + (inferior-python-mode): Remove redundant completion settings. + 2014-10-03 Dmitry Gutov * vc/vc-svn.el (vc-svn-ignore-completion-table): Implement. === modified file 'lisp/progmodes/python.el' --- lisp/progmodes/python.el 2014-10-02 15:13:05 +0000 +++ lisp/progmodes/python.el 2014-10-04 02:35:28 +0000 @@ -545,7 +545,7 @@ (res nil)) (while (and (setq res (re-search-forward re limit t)) (or (python-syntax-context 'paren) - (equal (char-after (point-marker)) ?=)))) + (equal (char-after (point)) ?=)))) res)) (1 font-lock-variable-name-face nil nil)) ;; support for a, b, c = (1, 2, 3) @@ -1042,9 +1042,9 @@ "De-indent current line." (interactive "*") (when (and (not (python-syntax-comment-or-string-p)) - (<= (point-marker) (save-excursion + (<= (point) (save-excursion (back-to-indentation) - (point-marker))) + (point))) (> (current-column) 0)) (python-indent-line t) t)) @@ -2399,12 +2399,8 @@ python-comint-postoutput-scroll-to-bottom)) (set (make-local-variable 'compilation-error-regexp-alist) python-shell-compilation-regexp-alist) - (define-key inferior-python-mode-map [remap complete-symbol] - 'completion-at-point) (add-hook 'completion-at-point-functions - 'python-shell-completion-at-point nil 'local) - (add-to-list (make-local-variable 'comint-dynamic-complete-functions) - 'python-shell-completion-at-point) + #'python-shell-completion-at-point nil 'local) (define-key inferior-python-mode-map "\t" 'python-shell-completion-complete-or-indent) (make-local-variable 'python-pdbtrack-buffers-to-kill) @@ -2960,7 +2956,7 @@ (interactive) (if (string-match "^[[:space:]]*$" (buffer-substring (comint-line-beginning-position) - (point-marker))) + (point))) (indent-for-tab-command) (completion-at-point))) @@ -3291,8 +3287,7 @@ (save-restriction (narrow-to-region (progn (while (python-syntax-context 'paren) - (goto-char (1- (point-marker)))) - (point-marker) + (goto-char (1- (point)))) (line-beginning-position)) (progn (when (not (python-syntax-context 'paren)) @@ -3301,8 +3296,8 @@ (skip-syntax-backward "^)"))) (while (and (python-syntax-context 'paren) (not (eobp))) - (goto-char (1+ (point-marker)))) - (point-marker))) + (goto-char (1+ (point)))) + (point))) (let ((paragraph-start "\f\\|[ \t]*$") (paragraph-separate ",") (fill-paragraph-function)) @@ -4323,7 +4318,8 @@ (add-to-list 'hs-special-modes-alist `(python-mode "^\\s-*\\(?:def\\|class\\)\\>" nil "#" ,(lambda (_arg) - (python-nav-end-of-defun)) nil)) + (python-nav-end-of-defun)) + nil)) (set (make-local-variable 'outline-regexp) (python-rx (* space) block-start)) ------------------------------------------------------------ revno: 118029 [merge] committer: Glenn Morris branch nick: trunk timestamp: Fri 2014-10-03 09:07:31 -0700 message: Merge from emacs-24; up to r117546 diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2014-10-03 15:44:46 +0000 +++ lisp/ChangeLog 2014-10-03 16:07:31 +0000 @@ -6,12 +6,12 @@ 2014-10-03 Martin Rudalics * frame.el (toggle-frame-maximized, toggle-frame-fullscreen): - In doc-string mention need of setting `frame-resize-pixelwise'. + In doc-string mention need to set `frame-resize-pixelwise'. 2014-10-03 Stefan Monnier * vc/vc-svn.el (vc-svn-after-dir-status): Fix the non-remote regexp, - similarly to Roger's 2010-06-12 change for the remote change + similarly to Rogers's 2010-06-16 change for the remote case (bug#18605). 2014-10-03 Stefan Monnier === modified file 'lisp/org/ChangeLog' --- lisp/org/ChangeLog 2014-10-03 15:44:46 +0000 +++ lisp/org/ChangeLog 2014-10-03 16:07:31 +0000 @@ -587,7 +587,7 @@ * ox-ascii.el (org-ascii--box-string): Choose more universal Unicode characters for boxquote corners. -2014-10-03 marcowahlsoft@gmail.com (tiny change) +2014-10-03 Marco Wahl (tiny change) * org-agenda.el (org-agenda-bulk-mark) (org-agenda-bulk-mark-regexp, org-agenda-bulk-toggle-all): Fix ------------------------------------------------------------ revno: 118028 committer: Glenn Morris branch nick: trunk timestamp: Fri 2014-10-03 09:05:12 -0700 message: ChangeLog merge fix Yet another unlabelled backport. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2014-10-03 15:44:46 +0000 +++ src/ChangeLog 2014-10-03 16:05:12 +0000 @@ -1,9 +1,3 @@ -2014-10-03 Dmitry Antipov - - * font.c (font_list_entities): Do not add empty vector to font cache. - (font_matching_entity): Likewise. If matching entity is found, insert - 1-item vector with this entity instead of an entity itself (Bug#17125). - 2014-10-03 Eli Zaretskii * xdisp.c (move_it_by_lines): Call reseat_1 after moving the ------------------------------------------------------------ revno: 118027 [merge] committer: Glenn Morris branch nick: trunk timestamp: Fri 2014-10-03 08:44:46 -0700 message: Merge from emacs-24; up to r117544 diff: === modified file 'ChangeLog' --- ChangeLog 2014-09-29 19:49:44 +0000 +++ ChangeLog 2014-10-03 15:44:46 +0000 @@ -1,3 +1,7 @@ +2014-10-03 Paul Eggert + + * configure.ac: Port to strict POSIX shells on non-MinGW (Bug#18612). + 2014-09-29 Eli Zaretskii * README: Bump version to 25.0.50. === modified file 'configure.ac' --- configure.ac 2014-10-02 15:13:05 +0000 +++ configure.ac 2014-10-03 15:44:46 +0000 @@ -151,7 +151,8 @@ # "/c/foo/bar", to simplify later conversions to native Windows # format ("c:/foo/bar"). srcdir=`cd "${srcdir}" && pwd -W` - srcdir="/${srcdir:0:1}${srcdir:2}" + # 'eval' pacifies strict POSIX non-MinGW shells (Bug#18612). + eval 'srcdir="/${srcdir:0:1}${srcdir:2}"' ;; esac;; esac === modified file 'doc/emacs/ChangeLog' --- doc/emacs/ChangeLog 2014-10-02 15:13:05 +0000 +++ doc/emacs/ChangeLog 2014-10-03 15:44:46 +0000 @@ -1,3 +1,9 @@ +2014-10-03 Martin Rudalics + + * frames.texi (Frame Commands): + * cmdargs.texi (Window Size X): Mention the use of + `frame-resize-pixelwise' to make frames truly fullscreen or maximized. + 2014-10-02 Glenn Morris * package.texi (Package Installation): Mention etc/package-keyring.gpg. === modified file 'doc/emacs/cmdargs.texi' --- doc/emacs/cmdargs.texi 2014-06-08 01:14:58 +0000 +++ doc/emacs/cmdargs.texi 2014-10-03 15:26:26 +0000 @@ -987,10 +987,10 @@ (@pxref{Table of Resources}); then Emacs will already know there's no tool bar when it processes the specified geometry. - When using one of @samp{--fullscreen}, @samp{--maximized}, @samp{--fullwidth} -or @samp{--fullheight} there may be some space around the frame -anyway. That is because Emacs rounds the sizes so they are an -even number of character heights and widths. + When using one of @samp{--fullscreen}, @samp{--maximized}, +@samp{--fullwidth} or @samp{--fullheight}, some window managers require +you to set the variable @code{frame-resize-pixelwise} to a non-@code{nil} +value to make a frame appear truly ``maximized'' or ``fullscreen''. Some window managers have options that can make them ignore both program-specified and user-specified positions. If these are set, === modified file 'doc/emacs/frames.texi' --- doc/emacs/frames.texi 2014-06-08 01:14:58 +0000 +++ doc/emacs/frames.texi 2014-10-03 09:18:49 +0000 @@ -469,6 +469,10 @@ Emacs itself.) @end table + Note that with some window managers you may have to customize the +variable @code{frame-resize-pixelwise} to a non-@code{nil} value in +order to make a frame truly ``maximized'' or ``fullscreen''. + The @kbd{C-x 5 0} (@code{delete-frame}) command deletes the selected frame. However, it will refuse to delete the last frame in an Emacs session, to prevent you from losing the ability to interact with the === modified file 'doc/lispref/ChangeLog' --- doc/lispref/ChangeLog 2014-10-01 20:34:55 +0000 +++ doc/lispref/ChangeLog 2014-10-03 15:44:46 +0000 @@ -1,3 +1,9 @@ +2014-10-03 Martin Rudalics + + * frames.texi (Size Parameters, Size and Position): Mention that + with some window managers you have to set `frame-resize-pixelwise' + in order make a frame truly fullscreen or maximized. + 2014-10-01 Paul Eggert Improve doc for use of 'int', and discuss 'ssize_t'. === modified file 'doc/lispref/frames.texi' --- doc/lispref/frames.texi 2014-04-17 07:54:23 +0000 +++ doc/lispref/frames.texi 2014-10-03 15:44:46 +0000 @@ -686,6 +686,11 @@ former can still be resized by dragging window manager decorations with the mouse, while the latter really covers the whole screen and does not allow resizing by mouse dragging. + +With some window managers you may have to customize the variable +@code{frame-resize-pixelwise} to a non-@code{nil} value in order to make +a frame appear ``maximized'' or ``fullscreen''. + @end table @node Layout Parameters @@ -966,7 +971,7 @@ A list of symbols, specifying the @dfn{font backends} to use for drawing fonts in the frame, in order of priority. On X, there are currently two available font backends: @code{x} (the X core font -driver) and @code{xft} (the Xft font driver). On Windows, there are +driver) and @code{xft} (the Xft font driver). On MS-Windows, there are currently two available font backends: @code{gdi} and @code{uniscribe} (@pxref{Windows Fonts,,, emacs, The GNU Emacs Manual}). On other systems, there is only one available font backend, @@ -1158,12 +1163,15 @@ be set only in a user's initial file; applications should never bind it temporarily. -The precise semantics of a value of @code{nil} for this option depends -on the toolkit used: Dragging the frame border with the mouse is usually -always done character-wise. Calling @code{set-frame-size} (see below) +The precise meaning of a value of @code{nil} for this option depends +on the toolkit used. Dragging the frame border with the mouse is usually +done character-wise. Calling @code{set-frame-size} (see below) with arguments that do not specify the frame size as an integer multiple -of its character size may be, however, either ignored or cause a -rounding (GTK+, Windows) or get accepted (Lucid, Motif). +of its character size, however, may: be ignored, cause a +rounding (GTK+), or be accepted (Lucid, Motif, MS-Windows). + +With some window managers you may have to set this to non-@code{nil} in +order to make a frame appear truly ``maximized'' or ``fullscreen''. @end defopt @defun set-frame-size frame width height pixelwise === modified file 'doc/misc/ChangeLog' --- doc/misc/ChangeLog 2014-10-03 13:02:53 +0000 +++ doc/misc/ChangeLog 2014-10-03 15:44:46 +0000 @@ -1,3 +1,23 @@ +2014-10-03 Bastien Guerry + + * org.texi (Key bindings and useful functions): Fix typo. + Use the correct function's name. + +2014-10-03 Michael Brand + + * org.texi (Formula syntax for Calc): Add `f-1' to TBLFM example + about `nan'. + +2014-10-03 Nicolas Goaziou + + * org.texi (Export settings): Be more explicit about how output + file name is built. + + * org.texi (Headings and sectioning structure): Document menus. + + * org.texi (Include files, Publishing options): Remove reference + to nonexistent variable. + 2014-10-03 Eli Zaretskii * erc.texi (Connecting): Remove stray "OA" that failed the manual === modified file 'doc/misc/org.texi' --- doc/misc/org.texi 2014-06-22 23:12:17 +0000 +++ doc/misc/org.texi 2014-10-03 15:44:46 +0000 @@ -2,7 +2,7 @@ @c %**start of header @setfilename ../../info/org.info @settitle The Org Manual -@set VERSION 8.2.6 +@set VERSION 8.2.8 @c Version and Contact Info @set MAINTAINERSITE @uref{http://orgmode.org,maintainers web page} @@ -584,8 +584,9 @@ * Markdown export:: Exporting to Markdown * OpenDocument Text export:: Exporting to OpenDocument Text * Org export:: Exporting to Org +* Texinfo export:: Exporting to Texinfo * iCalendar export:: Exporting to iCalendar -* Other built-in back-ends:: Exporting to @code{Texinfo} or a man page +* Other built-in back-ends:: Exporting to a man page * Export in foreign buffers:: Author tables and lists in Org syntax * Advanced configuration:: Fine-tuning the export output @@ -637,6 +638,16 @@ * Customizing tables in ODT export:: How to define and use Table templates * Validating OpenDocument XML:: How to debug corrupt OpenDocument files +Texinfo export + +* Texinfo export commands:: How to invoke Texinfo export +* Document preamble:: File header, title and copyright page +* Headings and sectioning structure:: Building document structure +* Indices:: Creating indices +* Quoting Texinfo code:: Incorporating literal Texinfo code +* Texinfo specific attributes:: Controlling Texinfo output +* An example:: + Publishing * Configuration:: Defining projects @@ -2725,9 +2736,11 @@ @item if($1 < 20, teen, string("")) "teen" if age $1 is less than 20, else the Org table result field is set to empty with the empty string. -@item if("$1" == "nan" || "$2" == "nan", string(""), $1 + $2); E +@item if("$1" == "nan" || "$2" == "nan", string(""), $1 + $2); E f-1 Sum of the first two columns. When at least one of the input fields is empty -the Org table result field is set to empty. +the Org table result field is set to empty. @samp{E} is required to not +convert empty fields to 0. @samp{f-1} is an optional Calc format string +similar to @samp{%.1f} but leaves empty results empty. @item if(typeof(vmean($1..$7)) == 12, string(""), vmean($1..$7); E Mean value of a range unless there is any empty field. Every field in the range that is empty is replaced by @samp{nan} which lets @samp{vmean} result @@ -4410,7 +4423,7 @@ @noindent @vindex org-log-done -you not only define global TODO keywords and fast access keys, but also +You not only define global TODO keywords and fast access keys, but also request that a time is recorded when the entry is set to DONE@footnote{It is possible that Org mode will record two timestamps when you are using both @code{org-log-done} and state change logging. @@ -9951,11 +9964,10 @@ @end example @noindent -The optional second and third parameter are the markup (e.g., @samp{quote}, -@samp{example}, or @samp{src}), and, if the markup is @samp{src}, the -language for formatting the contents. The markup is optional; if it is not -given, the text will be assumed to be in Org mode format and will be -processed normally. +The optional second and third parameter are the markup (i.e., @samp{example} +or @samp{src}), and, if the markup is @samp{src}, the language for formatting +the contents. The markup is optional; if it is not given, the text will be +assumed to be in Org mode format and will be processed normally. Contents of the included file will belong to the same structure (headline, item) containing the @code{INCLUDE} keyword. In particular, headlines within @@ -10364,8 +10376,9 @@ * Markdown export:: Exporting to Markdown * OpenDocument Text export:: Exporting to OpenDocument Text * Org export:: Exporting to Org +* Texinfo export:: Exporting to Texinfo * iCalendar export:: Exporting to iCalendar -* Other built-in back-ends:: Exporting to @code{Texinfo} or a man page +* Other built-in back-ends:: Exporting to a man page * Export in foreign buffers:: Author tables and lists in Org syntax * Advanced configuration:: Fine-tuning the export output @end menu @@ -10690,16 +10703,12 @@ Toggle inclusion of tables (@code{org-export-with-tables}). @end table -@cindex property, EXPORT_FILE_NAME When exporting only a subtree, each of the previous keywords@footnote{With the exception of @samp{SETUPFILE}.} can be overridden locally by special node properties. These begin with @samp{EXPORT_}, followed by the name of the keyword they supplant. For example, @samp{DATE} and @samp{OPTIONS} keywords become, respectively, @samp{EXPORT_DATE} and @samp{EXPORT_OPTIONS} -properties. Subtree export also supports the self-explicit -@samp{EXPORT_FILE_NAME} property@footnote{There is no buffer-wide equivalent -for this property. The file name in this case is derived from the file -associated to the buffer, if possible, or asked to the user otherwise.}. +properties. @cindex #+BIND @vindex org-export-allow-bind-keywords @@ -10708,6 +10717,13 @@ is @samp{#+BIND: variable value}. This is particularly useful for in-buffer settings that cannot be changed using specific keywords. +@cindex property, EXPORT_FILE_NAME +The name of the output file to be generated is taken from the file associated +to the buffer, when possible, or asked to you otherwise. For subtree export, +you can also set @samp{EXPORT_FILE_NAME} property. In all cases, only the +base name of the file is retained, and a back-end specific extension is +added. + @node ASCII/Latin-1/UTF-8 export, Beamer export, Export settings, Exporting @section ASCII/Latin-1/UTF-8 export @cindex ASCII export @@ -12834,7 +12850,324 @@ Export to an Org file, then open it. @end table -@node iCalendar export, Other built-in back-ends, Org export, Exporting +@node Texinfo export, iCalendar export, Org export, Exporting +@section Texinfo export +@cindex Texinfo export + +@samp{texinfo} export back-end generates Texinfo code and can compile it into +an Info file. + +@menu +* Texinfo export commands:: How to invoke Texinfo export +* Document preamble:: File header, title and copyright page +* Headings and sectioning structure:: Building document structure +* Indices:: Creating indices +* Quoting Texinfo code:: Incorporating literal Texinfo code +* Texinfo specific attributes:: Controlling Texinfo output +* An example:: +@end menu + +@node Texinfo export commands, Document preamble, Texinfo export, Texinfo export +@subsection Texinfo export commands + +@vindex org-texinfo-info-process +@table @kbd +@orgcmd{C-c C-e i t,org-texinfo-export-to-texinfo} +Export as a Texinfo file. For an Org file, @file{myfile.org}, the resulting +file will be @file{myfile.texi}. The file will be overwritten without +warning. +@orgcmd{C-c C-e i i,org-texinfo-export-to-info} +Export to Texinfo and then process to an Info file@footnote{By setting +@code{org-texinfo-info-process}, it is possible to generate other formats, +including DocBook.}. +@end table + +@node Document preamble, Headings and sectioning structure, Texinfo export commands, Texinfo export +@subsection Document preamble + +When processing a document, @samp{texinfo} back-end generates a minimal file +header along with a title page, a copyright page, and a menu. You control +the latter through the structure of the document (@pxref{Headings and +sectioning structure}). Various keywords allow to tweak the other parts. It +is also possible to give directions to install the document in the @samp{Top} +node. + +@subsubheading File header + +@cindex #+TEXINFO_FILENAME +Upon creating the header of a Texinfo file, the back-end guesses a name for +the Info file to be compiled. This may not be a sensible choice, e.g., if +you want to produce the final document in a different directory. Specify an +alternate path with @code{#+TEXINFO_FILENAME} keyword to override the default +destination. + +@vindex org-texinfo-coding-system +@vindex org-texinfo-classes +@cindex #+TEXINFO_HEADER +@cindex #+TEXINFO_CLASS +Along with the output file name, the header contains information about the +language (@pxref{Export settings}) and current encoding used@footnote{See +@code{org-texinfo-coding-system} for more information.}. Insert +a @code{#+TEXINFO_HEADER} keyword for each additional command needed, e.g., +@@code@{@@synindex@}. + +If you happen to regularly install the same set of commands, it may be easier +to define your own class in @code{org-texinfo-classes}, which see. Set +@code{#+TEXINFO_CLASS} keyword accordingly in your document to activate it. + +@subsubheading Title and copyright page + +@cindex #+TEXINFO_PRINTED_TITLE +@cindex #+SUBTITLE +The default template includes a title page for hard copy output. The title +and author displayed on this page are extracted from, respectively, +@code{#+TITLE} and @code{#+AUTHOR} keywords (@pxref{Export settings}). It is +also possible to print a different, more specific, title with +@code{#+TEXINFO_PRINTED_TITLE} keyword, and add subtitles with +@code{#+SUBTITLE} keyword. Both expect raw Texinfo code in their value. + +@cindex #+SUBAUTHOR +Likewise, information brought by @code{#+AUTHOR} may not be enough. You can +include other authors with several @code{#+SUBAUTHOR} keywords. Values are +also expected to be written in Texinfo code. + +@example +#+AUTHOR: Jane Smith +#+SUBAUTHOR: John Doe +#+TEXINFO_PRINTED_TITLE: This Long Title@@inlinefmt@{tex,@@*@} Is Broken in @@TeX@{@} +@end example + +@cindex property, COPYING +Copying material is defined in a dedicated headline with a non-nil +@code{:COPYING:} property. The contents are inserted within +a @code{@@copying} command at the beginning of the document whereas the +heading itself does not appear in the structure of the document. + +Copyright information is printed on the back of the title page. + +@example +* Copying + :PROPERTIES: + :COPYING: t + :END: + + This is a short example of a complete Texinfo file, version 1.0. + + Copyright \copy 2014 Free Software Foundation, Inc. +@end example + +@subsubheading The Top node + +@cindex #+TEXINFO_DIR_CATEGORY +@cindex #+TEXINFO_DIR_TITLE +@cindex #+TEXINFO_DIR_DESC +You may ultimately want to install your new Info file to your system. You +can write an appropriate entry in the top level directory specifying its +category and title with, respectively, @code{#+TEXINFO_DIR_CATEGORY} and +@code{#+TEXINFO_DIR_TITLE}. Optionally, you can add a short description +using @code{#+TEXINFO_DIR_DESC}. The following example would write an entry +similar to Org's in the @samp{Top} node. + +@example +#+TEXINFO_DIR_CATEGORY: Emacs +#+TEXINFO_DIR_TITLE: Org Mode: (org) +#+TEXINFO_DIR_DESC: Outline-based notes management and organizer +@end example + +@node Headings and sectioning structure, Indices, Document preamble, Texinfo export +@subsection Headings and sectioning structure + +@vindex org-texinfo-classes +@vindex org-texinfo-default-class +@cindex #+TEXINFO_CLASS +@samp{texinfo} uses a pre-defined scheme, or class, to convert headlines into +Texinfo structuring commands. For example, a top level headline appears as +@code{@@chapter} if it should be numbered or as @code{@@unnumbered} +otherwise. If you need to use a different set of commands, e.g., to start +with @code{@@part} instead of @code{@@chapter}, install a new class in +@code{org-texinfo-classes}, then activate it with @code{#+TEXINFO_CLASS} +keyword. Export process defaults to @code{org-texinfo-default-class} when +there is no such keyword in the document. + +If a headline's level has no associated structuring command, or is below +a certain threshold @pxref{Export settings}, that headline becomes a list in +Texinfo output. + +@cindex property, APPENDIX +As an exception, a headline with a non-nil @code{:APPENDIX:} property becomes +an appendix, independently on its level and the class used. + +@cindex property, DESCRIPTION +Each regular sectioning structure creates a menu entry, named after the +heading. You can provide a different, e.g., shorter, title in +@code{:ALT_TITLE:} property (@pxref{Table of contents}). Optionally, you can +specify a description for the item in @code{:DESCRIPTION:} property. E.g., + +@example +* Controlling Screen Display + :PROPERTIES: + :ALT_TITLE: Display + :DESCRIPTION: Controlling Screen Display + :END: +@end example + +@node Indices, Quoting Texinfo code, Headings and sectioning structure, Texinfo export +@subsection Indices + +@cindex #+CINDEX +@cindex #+FINDEX +@cindex #+KINDEX +@cindex #+PINDEX +@cindex #+TINDEX +@cindex #+VINDEX +Index entries are created using dedicated keywords. @samp{texinfo} back-end +provides one for each predefined type: @code{#+CINDEX}, @code{#+FINDEX}, +@code{#+KINDEX}, @code{#+PINDEX}, @code{#+TINDEX} and @code{#+VINDEX}. For +custom indices, you can write raw Texinfo code (@pxref{Quoting Texinfo +code}). + +@example +#+CINDEX: Defining indexing entries +@end example + +@cindex property, INDEX +To generate an index, you need to set the @code{:INDEX:} property of +a headline to an appropriate abbreviation (e.g., @samp{cp} or @samp{vr}). +The headline is then exported as an unnumbered chapter or section command and +the index is inserted after its contents. + +@example +* Concept Index + :PROPERTIES: + :INDEX: cp + :END: +@end example + +@node Quoting Texinfo code, Texinfo specific attributes, Indices, Texinfo export +@subsection Quoting Texinfo code + +It is possible to insert raw Texinfo code using any of the following +constructs + +@cindex #+TEXINFO +@cindex #+BEGIN_TEXINFO +@example +Richard @@@@texinfo:@@sc@{@@@@Stallman@@@@texinfo:@}@@@@ commence' GNU. + +#+TEXINFO: @@need800 +This paragraph is preceded by... + +#+BEGIN_TEXINFO +@@auindex Johnson, Mark +@@auindex Lakoff, George +#+END_TEXINFO +@end example + +@node Texinfo specific attributes, An example, Quoting Texinfo code, Texinfo export +@subsection Texinfo specific attributes + +@cindex #+ATTR_TEXINFO +@samp{texinfo} back-end understands several attributes in plain lists and +tables. They must be specified using an @code{#+ATTR_TEXINFO} keyword, +written just above the list or table. + +@subsubheading Plain lists + +In Texinfo output, description lists appear as two-column tables, using the +default command @code{@@table}. You can use @code{@@ftable} or +@code{@@vtable}@footnote{For more information, @inforef{Two-column +Tables,,texinfo}.} instead with @code{:table-type} attribute. + +@vindex org-texinfo-def-table-markup +In any case, these constructs require a highlighting command for entries in +the list. You can provide one with @code{:indic} attribute. If you do not, +it defaults to the value stored in @code{org-texinfo-def-table-markup}, which +see. + +@example +#+ATTR_TEXINFO: :indic @@asis +- foo :: This is the text for /foo/, with no highlighting. +@end example + +@subsubheading Tables + +When exporting a table, column widths are deduced from the longest cell in +each column. You can also define them explicitly as fractions of the line +length, using @code{:columns} attribute. + +@example +#+ATTR_TEXINFO: :columns .5 .5 +| a cell | another cell | +@end example + +@node An example, , Texinfo specific attributes, Texinfo export +@subsection An example + +Here is a thorough example, taken from @inforef{GNU Sample Texts,,texinfo}. + +@smallexample +#+MACRO: version 2.0 +#+MACRO: updated last updated 4 March 2014 + +#+OPTIONS: ':t toc:t author:t email:t +#+TITLE: GNU Sample @{@{@{version@}@}@} +#+AUTHOR: A.U. Thor +#+EMAIL: bug-sample@@gnu.org +#+LANGUAGE: en + +#+TEXINFO_FILENAME: sample.info +#+TEXINFO_HEADER: @@syncodeindex pg cp + +#+TEXINFO_DIR_CATEGORY: Texinfo documentation system +#+TEXINFO_DIR_TITLE: sample: (sample) +#+TEXINFO_DIR_DESC: Invoking sample + +#+TEXINFO_PRINTED_TITLE: GNU Sample +#+SUBTITLE: for version 2.0, last updated 4 March 2014 + +* Copying + :PROPERTIES: + :COPYING: t + :END: + + This manual is for GNU Sample (version @{@{@{version@}@}@}, + @{@{@{updated@}@}@}), which is an example in the Texinfo documentation. + + Copyright @@@@texinfo:@@copyright@{@}@@@@ 2013 Free Software Foundation, + Inc. + + #+BEGIN_QUOTE + Permission is granted to copy, distribute and/or modify this + document under the terms of the GNU Free Documentation License, + Version 1.3 or any later version published by the Free Software + Foundation; with no Invariant Sections, with no Front-Cover Texts, + and with no Back-Cover Texts. A copy of the license is included in + the section entitled "GNU Free Documentation License". + #+END_QUOTE + +* Invoking sample + + #+PINDEX: sample + #+CINDEX: invoking @@command@{sample@} + + This is a sample manual. There is no sample program to invoke, but + if there were, you could see its basic usage and command line + options here. + +* GNU Free Documentation License + :PROPERTIES: + :APPENDIX: t + :END: + + #+TEXINFO: @@include fdl.texi + +* Index + :PROPERTIES: + :INDEX: cp + :END: +@end smallexample + +@node iCalendar export, Other built-in back-ends, Texinfo export, Exporting @section iCalendar export @cindex iCalendar export @@ -12912,12 +13245,11 @@ @itemize @item @file{ox-man.el}: export to a man page. -@item @file{ox-texinfo.el}: export to @code{Texinfo} format. @end itemize To activate these export back-end, customize @code{org-export-backends} or -load them directly with e.g., @code{(require 'ox-texinfo)}. This will add -new keys in the export dispatcher (@pxref{The Export Dispatcher}). +load them directly with e.g., @code{(require 'ox-man)}. This will add new +keys in the export dispatcher (@pxref{The Export Dispatcher}). See the comment section of these files for more information on how to use them. @@ -13334,7 +13666,6 @@ @item @code{:headline-levels} @tab @code{org-export-headline-levels} @item @code{:language} @tab @code{org-export-default-language} @item @code{:preserve-breaks} @tab @code{org-export-preserve-breaks} -@item @code{:publishing-directory} @tab @code{org-export-publishing-directory} @item @code{:section-numbers} @tab @code{org-export-with-section-numbers} @item @code{:select-tags} @tab @code{org-export-select-tags} @item @code{:with-author} @tab @code{org-export-with-author} @@ -15473,10 +15804,10 @@ @item @kbd{C-c C-c} @tab @code{org-babel-execute-src-block} @kindex C-c C-o @item @kbd{C-c C-o} @tab @code{org-babel-open-src-block-result} -@kindex C-up -@item @kbd{C-@key{up}} @tab @code{org-babel-load-in-session} +@kindex M-up +@item @kbd{M-@key{up}} @tab @code{org-babel-load-in-session} @kindex M-down -@item @kbd{M-@key{down}} @tab @code{org-babel-pop-to-session} +@item @kbd{M-@key{down}} @tab @code{org-babel-switch-to-session} @end multitable In an Org mode buffer, the following key bindings are active: @@ -18208,7 +18539,6 @@ @bye @c Local variables: -@c coding: utf-8 @c fill-column: 77 @c indent-tabs-mode: nil @c paragraph-start: "\\|^@[a-zA-Z]*[ \n]\\|^@x?org\\(key\\|cmd\\)\\|\f\\|[ ]*$" === modified file 'etc/org/OrgOdtContentTemplate.xml' --- etc/org/OrgOdtContentTemplate.xml 2012-09-30 15:14:59 +0000 +++ etc/org/OrgOdtContentTemplate.xml 2014-10-03 08:13:51 +0000 @@ -46,7 +46,19 @@ + + + + + + + + + + + === modified file 'etc/org/OrgOdtStyles.xml' --- etc/org/OrgOdtStyles.xml 2012-09-30 15:14:59 +0000 +++ etc/org/OrgOdtStyles.xml 2014-10-03 08:13:51 +0000 @@ -86,7 +86,11 @@ - + + + + + @@ -252,26 +256,44 @@ + + + + - + + + + + + + + - + - + + + + + + + + @@ -279,6 +301,9 @@ + + + @@ -325,9 +350,10 @@ - + + @@ -349,23 +375,41 @@ - - - - - - + + + - - - - - + + + + + + + + + + + + + + - + + + + + + + + + / + + / + + @@ -441,7 +485,7 @@ - + === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2014-10-03 01:39:49 +0000 +++ lisp/ChangeLog 2014-10-03 15:44:46 +0000 @@ -1,3 +1,19 @@ +2014-10-03 Dmitry Gutov + + * vc/vc-svn.el (vc-svn-ignore-completion-table): Implement. + (vc-svn-ignore): Use it. (Bug#18619) + +2014-10-03 Martin Rudalics + + * frame.el (toggle-frame-maximized, toggle-frame-fullscreen): + In doc-string mention need of setting `frame-resize-pixelwise'. + +2014-10-03 Stefan Monnier + + * vc/vc-svn.el (vc-svn-after-dir-status): Fix the non-remote regexp, + similarly to Roger's 2010-06-12 change for the remote change + (bug#18605). + 2014-10-03 Stefan Monnier New gui-selection-value consolidating x-selection-value. === modified file 'lisp/frame.el' --- lisp/frame.el 2014-10-02 13:26:23 +0000 +++ lisp/frame.el 2014-10-03 15:44:46 +0000 @@ -1831,6 +1831,11 @@ just toggle the temporary frame parameter `maximized', so the frame will go to the right maximization state after disabling fullscreen mode. + +Note that with some window managers you may have to set +`frame-resize-pixelwise' to non-nil in order to make a frame +appear truly maximized. + See also `toggle-frame-fullscreen'." (interactive) (if (memq (frame-parameter nil 'fullscreen) '(fullscreen fullboth)) @@ -1852,6 +1857,11 @@ When turning on fullscreen mode, remember the previous value of the maximization state in the temporary frame parameter `maximized'. Restore the maximization state when turning off fullscreen mode. + +Note that with some window managers you may have to set +`frame-resize-pixelwise' to non-nil in order to make a frame +appear truly fullscreen. + See also `toggle-frame-maximized'." (interactive) (modify-frame-parameters === modified file 'lisp/org/ChangeLog' --- lisp/org/ChangeLog 2014-06-23 15:32:24 +0000 +++ lisp/org/ChangeLog 2014-10-03 15:44:46 +0000 @@ -1,3 +1,598 @@ +2014-10-03 Achim Gratz + + * ob-sh.el (org-babel-sh-initiate-session): After initiating a + session, initialize the marker `comint-last-output-start' since it + is going to be used by the ANSI color filter without further + checks in Emacs 23 and throws an error. + + * ob-lilypond.el: Change prefix from `ly-' to + `org-babel-lilypond-' throughout. + + * org-footnote.el: Forward declare `org-element-context', + `org-element-property' and `org-element-type'. + + * org.el: Add forward declarations for a number of functions that + the compiler otherwise warns about as potentially undefined at + runtime. + + * ob-core.el: Add comment to forward declaration of + 'org-src-preserve-indentations'. + + * ob-exp.el: Require org-src to import + 'org-src-preserve-indentations'. + + * ob-haskell.el, ob-python.el: Remove superfluous forward + declaration of 'org-src-preserve-indentations', since it gets + imported by other requires. + + * ob-core.el (org-every): Forward declare 'org-every'. + + * ob-C.el: Require cl during compilation so that lexical-let is + known. + + * org-entities.el: Remove superfluous require of org-macs. + Forward declare 'org-toggle-pretty-entities' and + 'org-pretty-entities'. + + * ox.el (org-export-get-parent): Move definition of + 'org-export-get-parent' before first use. Leave comment at original + place of definition. + + * org.el (org-uniquify): Move definition of 'org-uniquify' before + first use. Leave comment at original place of definition. + + * ob-tangle.el (org-babel-tangle): When `file-name-directory' + returns nil, do not run make-directory. Remove superfluous when + clauses by using short-circuiting `and' instead. + +2014-10-03 Alex Kosorukoff (tiny change) + + * org-capture.el (org-capture-fill-template): Set `mark-active' to + nil. + +2014-10-03 Bastien Guerry + + * org-agenda.el (org-agenda-prepare): Reset preset filters when + using sticky agendas. + + * org-agenda.el (org-agenda-get-sexps): Don't add tags as text + properties. + + * org-capture.el (org-capture-fill-template): Take + `org-extend-today-until' into account when setting the format time + string. + + * org.el (org-paste-subtree): Fix match subexpression. + + * org.el (org-fix-ellipsis-at-bol): Delete. + (org-mode, org-show-context, org-isearch-end): Don't use + `org-fix-ellipsis-at-bol'. + + * org-agenda.el (org-agenda-filter-apply): Fix setting of + `org-agenda-filtered-by-category'. + + * org.el (org-fontify-meta-lines-and-blocks-1): Fix handling + of `org-hidden-keywords'. + + * org-agenda.el (org-cmp-ts): Fix agenda entry type checking. + + * org-agenda.el (org-entries-lessp): Fix inactive timestamp + comparison. + + * org-agenda.el (org-agenda-mode): Let `org-agenda-redo' DTRT + when agenda are sticky. + (org-agenda-tag-filter-while-redo): Delete. + (org-agenda-list, org-agenda-redo, org-agenda-filter-by-tag): + Remove unused code. + (org-agenda-clockreport-mode, org-agenda-set-mode-name): Don't + consider tag filters. + + * org.el (org-fix-ellipsis-at-bol) + (org-first-headline-recenter): Use `set-window-start' instead + of `recenter'. + + * org-agenda.el (org-recenter-heading): Delete. + + * org.el (org-insert-heading): With one universal prefix argument + or `org-insert-heading-respect-content' set to `t', always respect + the content, i.e. don't insert a list item and don't convert + normal lines into headings. Update docstring. + (org-insert-heading-respect-content): Remove unused arg. + (org-insert-todo-heading-respect-content): Don't use + `org-insert-todo-heading-respect-content', use the second argument + of `org-insert-todo-heading' instead. + + * org-mobile.el (org-mobile-edit): Use only one arg. + + * org.el (org-overview): Don't call `recenter'. + + * org-agenda.el (org-agenda-custom-commands-local-options): Fix + misquoted values. + + * org.el (org-property-re): Also match null properties by default. + (org-entry-delete): Also delete null properties. + (org-read-property-value): Allow the empty string as a new value. + (org-delete-property): Throw a message when there is not property + to delete. + + * org-agenda.el (org-agenda-insert-diary-make-new-entry): Fix + docstring. + + * org.el (org-re-property): New parameter `allow-null' to match + property with a null value. + (org-entry-put): Correctly update a property with a null + value. + + * ox-md.el (org-md-headline): When exporting with a HTML table of + contents, add HTML anchors to Markdown headlines. + + * org.el (org-insert-heading): Don't insert an item when called + with two universal prefix arguments. + + * org-agenda.el (org-agenda-finalize): Remove duplicate check for + 'org-hd-marker. + + * org-agenda.el (org-agenda-prepare-window): New parameter + `filter-alist' to set the filters correctly when + `org-agenda-persistent-filter' is on. + (org-agenda-prepare): Use the new parameter for + `org-agenda-prepare-window'. + + * org-compat.el (org-in-invisibility-spec-p): Tiny code cleanup. + (org-move-to-column): Only remove '(org-filtered) from + `buffer-invisibility-spec'. + + * org-agenda.el (org-agenda-mode): Add buffer invisibility specs. + (org-agenda-filter-hide-line, org-agenda-remove-filter): Set + the 'invisible text property to 'org-filtered. + (org-agenda-show-new-time): Add the default face to avoid the + foreground of the last character on the line to leak into the + timestamp notification. + + * org-agenda.el (org-get-time-of-day): Don't return time string + from within links. + + * org-timer.el (org-timer-value-string): Always return a positive + value. Add docstring. + + * org-capture.el (org-capture-steal-local-variables): Don't steal + `mark-active', which should be nil in the target buffer. + + * org-agenda.el (org-agenda-remove-filter): Use `save-excursion'. + + * org.el (org-move-subtree-down): Use `org-end-of-subtree' instead + of `outline-end-of-subtree'. + (outline-end-of-subtree): Remove advice. + + * org-mouse.el (org-mouse-move-tree, org-mouse-do-remotely): Use + `org-end-of-subtree' instead of `outline-end-of-subtree'. + + * org-agenda.el (org-cmp-ts): Argument `type' is not optional. + Don't quote it. + + * org-habit.el (org-habit-insert-consistency-graphs): Don't remove + filter overlays as we don't use overlays for filters anymore. + + * org-agenda.el (org-agenda-local-vars): Add + `org-agenda-top-headline-filter'. + (org-agenda-filter-by-category): Fix syntax. + (org-agenda-filter-show-all-top-filter): New function. + (org-agenda-filter-by-top-headline) + (org-agenda-filter-remove-all): Use the new function. + (org-agenda-filter-top-headline-apply): Use a dedicated symbol + `top-headline'. + + * org.el (org-entry-properties): Ensure the special property is + not commented out when matched. + + * org-agenda.el (org-agenda-write): Code cleanup. + (org-agenda-mark-filtered-text) + (org-agenda-unmark-filtered-text) + (org-agenda-fix-tags-filter-overlays-at): Delete. + (org-agenda-remove-marked-text): Use the `property' argument + instead of hard-coding 'org-filtered. + (org-agenda-filter-remove-all): Use `org-agenda-finalize'. + (org-agenda-filter-hide-line): Rewrite using text properties + instead of overlays. + (org-agenda-remove-filter): New function. + (org-agenda-filter-show-all-tag) + (org-agenda-filter-show-all-cat) + (org-agenda-filter-show-all-re): Rewrite using + `org-agenda-remove-filter'. + + * org-attach.el (org-attach-dir): When the property is "inherited" + from a variable outside of the file, do not use + `org-entry-property-inherited-from' to find the attachment + position, assume we need to go back to the current headline. + + * ob-R.el (org-babel-R-assign-elisp): Fix parsing of a + one-dimensional value. + + * org.el (org-insert-heading): Fix bug when trying to insert a + heading when point is before the first headline and not at the + beginning of a line. + + * org-table.el (org-table-eval-formula): Fix conversion of + inactive timestamps to active ones. + + * org.el (org-set-regexps-and-options): Allow + `org-complex-heading-regexp-format' to match [/] and [%] cookies + when they are both before and after the heading. + + * org-agenda.el (org-agenda-max-todos, org-agenda-max-tags) + (org-agenda-max-effort): Fix type strings. + + * org-capture.el (org-capture-fill-template): Deactivate region + while trying to align tags on the current headline. + + * org-agenda.el (org-agenda-finalize): Filter by top headline if + `org-agenda-top-headline-filter' is set. + +2014-10-03 Bernt Hansen + + * org-macs.el: Remove restriction when locating markers. + +2014-10-03 Dmitry Gorbik (tiny change) + + * org.el (org-fast-tag-selection): Fix window splitting. + +2014-10-03 Eric Schulte + + * ob-screen.el (org-babel-screen-test): Use unpredictable name for + temporary file. + + * ob-screen.el (org-babel-screen-session-write-temp-file): Use + unpredictable temp file name, fixes bug#17416. + +2014-10-03 Ian Kelling + + * ob-core.el (org-babel-insert-result): Test all list elements + against listp and (eq element 'hline) instead of checking just the + first. + +2014-10-03 Konstantin Kliakhandler (tiny change) + + * org-agenda.el (org-agenda-redo): Reapply the filters correctly. + +2014-10-03 Kyle Meyer (tiny change) + + * ox.el (org-export-show-temporary-export-buffer): Fix typo. + +2014-10-03 Matt Lundin + + * ox-publish.el (org-publish-find-title, org-publish-find-date): + Make sure to call org-export-get-environment in copy of buffer if + emacs is already visiting. Otherwise, #+bind variables meant for + export can be set in live buffers. + + * org.el (org-agenda-inhibit-startup): fix docstring to reflect + default value + + * ox-publish.el (org-publish-find-title, org-publish-find-date): + Fix unnecessary invocations of org-mode with org-inhibit-startup. + +2014-10-03 Nick Dokos + + * org-table.el (org-table-clean-before-export): The regexes match + spaces in addition to the special characters that might be used in + the first column as special marking characters. Remove the space + from the character class. + + * ox-ascii.el (org-ascii-superscript): Change _ to ^ in the + output. + +2014-10-03 Nick Dokos + + * org-table.el (org-table-show-reference): Call `set-window-start' + with the calculated values `min' and `max', not with + (point-min) and (point-max). + +2014-10-03 Nicolas Goaziou + + * ox-latex.el (org-latex-link): Improve test for unnumbered + headlines. + + * ox-ascii.el (org-ascii--fill-string): Allow filling even when + `org-export-preserve-breaks' is non-nil. + + * org.el (org-N-empty-lines-before-current): Make sure to delete + only empty lines, not trailing whitespaces. + + * ox-html.el (org-html-headline): Make sure even listified + headlines have proper anchors so internal links can refer to them. + Small refactoring. + + * org-src.el (org-edit-src-code): Fix regexp. + (org-edit-src-exit): Do not remove auto-save timer. This is + handled by the timer itself. + + * org.el (org-re-property): Fix regexp. Improve docstring. + + * org-element.el (org-element-property-drawer-parser) + (org-element-node-property-parser): Ignore lines that are not node + properties. + (org-element-node-property-interpreter): Allow nil properties. + + * org.el (org-re-property): Fix regexp to match properties with + empty values. + + * org-element.el (org-element-headline-interpreter): Take into + consideration `org-odd-levels-only' value. Small refactoring. + + * ox-texinfo.el (org-texinfo--get-node): Return a node or anchor + name. + (org-texinfo--sanitize-content): Fix regexp. + (org-texinfo-link): Fix various bugs in link export. + + * ox-beamer.el (org-beamer-link): + * ox-html.el (org-html-link): + * ox-latex.el (org-latex-link): + * ox-odt.el (org-odt-link): When radio link has no valid + target (e.g., this is a subtree export and the radio target is not + in the exported subtree), simply return contents. + + * org.el (org-called-with-limited-levels): Initialize variable. + + * org-agenda.el (org-agenda-write): Write headings in proper + order. + + * org-element.el (org-element-table-interpreter): Enhance + docstring. + + * ox-md.el (org-md-link): Allow custom link type export function. + + * ox-texinfo.el (org-texinfo-template): Fix language and encoding + case. + + * ox-md.el (org-md-separate-elements): Outside of lists, preserve + blank lines between paragraphs and plain lists. + + * org-element.el (org-element-normalize-contents): Fix indentation + removal when there is an empty line within a verse block. + + * ox-texinfo.el (org-texinfo--normalize-headlines): Properly add a + section to the contents. + + * ox-texinfo.el (org-texinfo--normalize-headlines): Do not set pre + blanks since the value is now hard-coded. + (org-texinfo-headline): Force one blank line before contents, when non + empty. Refactoring. + (org-texinfo-src-block): Refactor code. Comply to predicate naming. + + * ox-texinfo.el (org-texinfo--sanitize-node): Handle + " (not)allowed" case. + + * ox-texinfo.el (org-texinfo-headline): Remove wrong code + comments. + + * ox-texinfo.el (org-texinfo-headline): Remove `not-in-toc' + special case for tags. + + * ox-texinfo.el (org-texinfo-headline): Remove LaTeXism (optional + arguments within square brackets). + + * ox-texinfo.el (org-texinfo-info-process): Fix docstring. + (org-texinfo-compile): Do not check for impossible cases (e.g., if the + previous variable contains a function). + + * ox-texinfo.el (org-texinfo-max-toc-depth): Fix docstring. + + * ox-texinfo.el (org-texinfo--make-option-string, + org-texinfo--sanitize-headline, + org-texinfo--sanitize-headline-contents): Remove. + + * ox-texinfo.el (org-texinfo--sanitize-node): "@", "{" and "}" + characters are allowed in a node name. So are "(" and ")" unless + "(" starts the name and there is ")" somewhere in the name. Also + trim and collapse whitespace characters. Renamed from + `org-texinfo--sanitize-menu'. + (org-texinfo--get-node): Do not sanitize node names over zealously. + Ensure returned node names are unique. + (org-texinfo-headline): Only add @node command where it makes sense. + + * ox-texinfo.el (org-texinfo--sanitize-menu) + (org-texinfo--sanitize-content): Fix docstrings. + + * ox-texinfo.el (org-texinfo--normalize-headlines): Make sure a + blank line always follows nodes. + + * ox-texinfo.el (org-texinfo-make-menu): Change signature. Remove + some intermediate functions. Generate the full master menu when + asked. + (org-texinfo--build-menu): Use a simpler algorithm. + (org-texinfo--format-entries): Fix entries when both node and title + are different. + (org-texinfo--menu-entries): Renamed from `org-texinfo--generate-menu-list'. + (org-texinfo-headline): Move menu handling to next function. + (org-texinfo-section): Handle menu for current parent. + (org-texinfo--menu-headlines, org-texinfo--generate-detailed): Remove + functions. + (org-texinfo--normalize-headlines): New function. + + * ox-texinfo.el (org-texinfo-headline): Fix @appendix command. + + * ox-texinfo.el (org-texinfo-headline): Do not sanitize heading + text for sectioning command. + + * ox-texinfo.el (org-texinfo--generate-menu-list): ":COPYING: nil" + is expected to be equivalent to no COPYING property at all. + + * ox-texinfo.el (org-texinfo-item): Fix blank lines between items. + + * ox-texinfo.el (org-texinfo-plain-list): Fix format string. + Small refactoring. + + * ox-texinfo.el (texinfo): Provide new export property. + (org-texinfo-template): Use dedicated title for hard copy, when + available. + + * ox-texinfo.el (org-texinfo-headline): Always obey to a non-nil + :APPENDIX: property. Small refactoring. + + * ox-texinfo.el (org-texinfo-verse-block): Generate somewhat + meaningful Texinfo code instead of LaTeX. + + * ox-texinfo.el (org-texinfo-table): Remove reference to + "verbatim" attribute. Handle table.el tables. Tiny refactoring. + (org-texinfo-table--org-table, org-texinfo-table--table.el-table): + Remove functions. + (org-texinfo-table-column-widths): Indent code correctly. Ignore + special column, if any. Add a comment about the limitation on the + width computation. + (org-texinfo-table-row): Small refactoring. + + * ox-texinfo.el (texinfo): Do not provide a default value for + @setfilename value. + (org-texinfo-filename): Remove variable. + (org-texinfo-template): Correctly find value for @setfilename command. + If none is possible, do not provide the command at all. + + * ox.el (org-export-to-file): Provide output file name in + communication channel, through :output-file property. + + * ox-texinfo.el (org-texinfo-template): Do not hardcode "Manual" + in top node. + + * ox-texinfo.el (org-texinfo-classes): Change default value. + Update docstring. + (org-texinfo-template): Insert header string from current class after + "@settitle" command. Always provide "\input texinfo" at the beginning + of the output. + + * ox-texinfo.el (org-texinfo-template): Remove spurious blank + lines in output. Refactor code. + + * ox-texinfo.el (org-texinfo-template): Fix multi-line subtitles. + + * ox-texinfo.el (org-texinfo-template): Make sure table of + contents are allowed before inserting them. + + * ox-texinfo.el (org-texinfo-template): Check if copying data is + not nil before using it. + + * ox-texinfo.el (org-texinfo-template): Fix multi-line subauthors. + Correctly add email, when provided. Check if author info is + wanted first. + + * ox-texinfo.el (org-texinfo-node-description-column) + (org-texinfo-format-drawer-function): Fix docstrings. + + * ox-texinfo.el (texinfo): Make sure comments are ignored. + (org-texinfo-comment, org-texinfo-comment-block): Remove functions. + + * ox-texinfo.el (org-texinfo-template): Properly pad @direntry + description. + + * org-element.el (org-element-headline-parser): Add missing + `:post-blank' property in docstring. + + * ox-latex.el (org-latex-table-scientific-notation): Set + appropriate value. + (org-latex-listings-options): Fix docstring. + + * ox.el (org-export-raw-special-block-p): New function. + + * org-element.el (org-element-link-parser): Properly handle + multi-line links according to RFC 3986 when enclosed within square + brackets. + + * org-element.el (org-element-parse-secondary-string): Clone all + local variables from current buffer before parsing a secondary + string. Small refactoring. + (org-element-object-variables): Remove variable. + + * ox-odt.el (org-odt--format-paragraph): Change signature to + include info. + (org-odt-footnote-reference, org-odt-paragraph): Apply signature + change. + + * org-clock.el (org-clocktable-indent-string): Use "\emsp" instead + of "\__", which is not supported anymore since Org 8.0. + + * ox-odt.el (org-odt--paragraph-style): New function. + (org-odt--format-paragraph): Use new function to get proper style + to apply. + + * org-element.el (org-element--current-element): Fix regexp. + + * org-element.el (org-element--current-element): Fix regexp + matching latex environments. Discrepancy with regexp used in + `org-element-latex-environment-parser' introduced matching errors. + + * ox-ascii.el (org-ascii--table-cell-width): Correctly export + tables with width cookies. + + * org.el (org-insert-heading): Fix error when inserting a headline + before first headline, with point not at bol. Remove source block + check for consistency with behavior after first headline. Tiny + fix to docstring. + + * org.el (org-scan-tags): Fix typo in docstring. + + * ox.el (org-export--get-inbuffer-options): Return the empty + string instead of nil when TITLE keywords has no value. + (org-export--get-buffer-attributes): Do not set :title property + early. + (org-export--get-global-options): Do not ignore anymore nil values. + Small refactoring. + (org-export-as): Correctly set :title here. + + * org-list.el (org-list-repair): Fix typo in docstring. + + * ox-ascii.el (org-ascii--current-text-width): Tiny fix. + + * ox-org.el (org-org-section): Tiny refactoring. Use appropriate + property. + + * ox-org.el (org-org-headline): Ignore footnote sections. + (org-org-section): New function. + + * ox-beamer.el (org-beamer-select-environment): Ignore persistent + tags when displaying environments. + + * ox-ascii.el (org-ascii-indented-line-width): Update docstring. + (org-ascii-paragraph): Do not apply indentation to the very first line + of a section. + + * ox-latex.el (org-latex-inlinetask): Skip body if contents are + empty. + + * ox-html.el (org-html-standalone-image-p): Ensure paragraph + contains at least a link before return a non-nil value. Clarify + docstring. + + * ox.el (org-export-data): Always return a string, as specified + by the docstring. + + * ox-ascii.el (org-ascii--indent-string): Fix regexp to avoid + stack overflow in regexp matcher on very long lines. + + * org-element.el (org-element-timestamp-parser): Fix docstring. + + * ox-icalendar.el (org-icalendar-include-sexps, + org-icalendar-blocked-headline-p): Fix docstrings. + (org-icalendar-clear-blank-lines): Fix docstring and regexp. + + * ox-icalendar.el (org-icalendar-entry): Use + `org-icalendar-with-timestamps'. + +2014-10-03 Nicolas Richard + + * org.el (org-cycle-internal-local): Don't show a trailing + character when cycling a subtree that ends with a non-newline + character at the end of the buffer or the narrowed region. + +2014-10-03 Sebastien Vauban + + * ox-ascii.el (org-ascii--box-string): Choose more universal + Unicode characters for boxquote corners. + +2014-10-03 marcowahlsoft@gmail.com (tiny change) + + * org-agenda.el (org-agenda-bulk-mark) + (org-agenda-bulk-mark-regexp, org-agenda-bulk-toggle-all): Fix + org-agenda-bulk-mark-all when time-grid is shown. + 2014-06-23 Stefan Monnier * org-compat.el (activate-mark): Set transient-mark-mode buffer-locally. === modified file 'lisp/org/ob-C.el' --- lisp/org/ob-C.el 2014-01-01 07:43:34 +0000 +++ lisp/org/ob-C.el 2014-10-03 08:13:51 +0000 @@ -30,6 +30,8 @@ ;; - not much in the way of error feedback ;;; Code: +(eval-when-compile + (require 'cl)) (require 'ob) (require 'cc-mode) === modified file 'lisp/org/ob-R.el' --- lisp/org/ob-R.el 2014-01-01 07:43:34 +0000 +++ lisp/org/ob-R.el 2014-10-03 08:13:51 +0000 @@ -173,12 +173,11 @@ (defun org-babel-R-assign-elisp (name value colnames-p rownames-p) "Construct R code assigning the elisp VALUE to a variable named NAME." (if (listp value) - (let ((max (apply #'max (mapcar #'length (org-remove-if-not - #'sequencep value)))) - (min (apply #'min (mapcar #'length (org-remove-if-not - #'sequencep value)))) - (transition-file (org-babel-temp-file "R-import-"))) - ;; ensure VALUE has an orgtbl structure (depth of at least 2) + (let* ((lengths (mapcar 'length (org-remove-if-not 'sequencep value))) + (max (if lengths (apply 'max lengths) 0)) + (min (if lengths (apply 'min lengths) 0)) + (transition-file (org-babel-temp-file "R-import-"))) + ;; Ensure VALUE has an orgtbl structure (depth of at least 2). (unless (listp (car value)) (setq value (list value))) (with-temp-file transition-file (insert === modified file 'lisp/org/ob-core.el' --- lisp/org/ob-core.el 2014-06-22 05:43:58 +0000 +++ lisp/org/ob-core.el 2014-10-03 15:44:46 +0000 @@ -38,6 +38,7 @@ (defvar org-src-lang-modes) (defvar org-babel-library-of-babel) (declare-function show-all "outline" ()) +(declare-function org-every "org" (pred seq)) (declare-function org-reduce "org" (CL-FUNC CL-SEQ &rest CL-KEYS)) (declare-function org-mark-ring-push "org" (&optional pos buffer)) (declare-function tramp-compat-make-temp-file "tramp-compat" @@ -1348,7 +1349,7 @@ (org-entry-get org-babel-current-src-block-location (concat "header-args:" lang) 'inherit)))))) -(defvar org-src-preserve-indentation) +(defvar org-src-preserve-indentation) ;; declare defcustom from org-src (defun org-babel-parse-src-block-match () "Parse the results from a match of the `org-babel-src-block-regexp'." (let* ((block-indentation (length (match-string 1))) @@ -2100,9 +2101,9 @@ ((funcall proper-list-p result) (goto-char beg) (insert (concat (orgtbl-to-orgtbl - (if (or (eq 'hline (car result)) - (and (listp (car result)) - (listp (cdr (car result))))) + (if (org-every + (lambda (el) (or (listp el) (eq el 'hline))) + result) result (list result)) '(:fmt (lambda (cell) (format "%s" cell)))) "\n")) (goto-char beg) (when (org-at-table-p) (org-table-align))) === modified file 'lisp/org/ob-exp.el' --- lisp/org/ob-exp.el 2014-04-22 14:07:45 +0000 +++ lisp/org/ob-exp.el 2014-10-03 08:13:51 +0000 @@ -24,6 +24,7 @@ ;;; Code: (require 'ob-core) +(require 'org-src) (eval-when-compile (require 'cl)) === modified file 'lisp/org/ob-haskell.el' --- lisp/org/ob-haskell.el 2014-01-01 07:43:34 +0000 +++ lisp/org/ob-haskell.el 2014-10-03 08:13:51 +0000 @@ -147,7 +147,6 @@ (concat "[" (mapconcat #'org-babel-haskell-var-to-haskell var ", ") "]") (format "%S" var))) -(defvar org-src-preserve-indentation) (defvar org-export-copy-to-kill-ring) (declare-function org-export-to-file "ox" (backend file === modified file 'lisp/org/ob-lilypond.el' --- lisp/org/ob-lilypond.el 2014-01-01 07:43:34 +0000 +++ lisp/org/ob-lilypond.el 2014-10-03 08:13:51 +0000 @@ -39,62 +39,62 @@ (defvar org-babel-default-header-args:lilypond '() "Default header arguments for lilypond code blocks. NOTE: The arguments are determined at lilypond compile time. -See (ly-set-header-args)") +See (org-babel-lilypond-set-header-args)") -(defvar ly-compile-post-tangle t +(defvar org-babel-lilypond-compile-post-tangle t "Following the org-babel-tangle (C-c C-v t) command, -ly-compile-post-tangle determines whether ob-lilypond should +org-babel-lilypond-compile-post-tangle determines whether ob-lilypond should automatically attempt to compile the resultant tangled file. If the value is nil, no automated compilation takes place. Default value is t") -(defvar ly-display-pdf-post-tangle t +(defvar org-babel-lilypond-display-pdf-post-tangle t "Following a successful LilyPond compilation -ly-display-pdf-post-tangle determines whether to automate the +org-babel-lilypond-display-pdf-post-tangle determines whether to automate the drawing / redrawing of the resultant pdf. If the value is nil, the pdf is not automatically redrawn. Default value is t") -(defvar ly-play-midi-post-tangle t +(defvar org-babel-lilypond-play-midi-post-tangle t "Following a successful LilyPond compilation -ly-play-midi-post-tangle determines whether to automate the +org-babel-lilypond-play-midi-post-tangle determines whether to automate the playing of the resultant midi file. If the value is nil, the midi file is not automatically played. Default value is t") -(defvar ly-OSX-ly-path +(defvar org-babel-lilypond-OSX-ly-path "/Applications/lilypond.app/Contents/Resources/bin/lilypond") -(defvar ly-OSX-pdf-path "open") -(defvar ly-OSX-midi-path "open") - -(defvar ly-nix-ly-path "/usr/bin/lilypond") -(defvar ly-nix-pdf-path "evince") -(defvar ly-nix-midi-path "timidity") - -(defvar ly-w32-ly-path "lilypond") -(defvar ly-w32-pdf-path "") -(defvar ly-w32-midi-path "") - -(defvar ly-gen-png nil +(defvar org-babel-lilypond-OSX-pdf-path "open") +(defvar org-babel-lilypond-OSX-midi-path "open") + +(defvar org-babel-lilypond-nix-ly-path "/usr/bin/lilypond") +(defvar org-babel-lilypond-nix-pdf-path "evince") +(defvar org-babel-lilypond-nix-midi-path "timidity") + +(defvar org-babel-lilypond-w32-ly-path "lilypond") +(defvar org-babel-lilypond-w32-pdf-path "") +(defvar org-babel-lilypond-w32-midi-path "") + +(defvar org-babel-lilypond-gen-png nil "Image generation (png) can be turned on by default by setting -LY-GEN-PNG to t") +ORG-BABEL-LILYPOND-GEN-PNG to t") -(defvar ly-gen-svg nil +(defvar org-babel-lilypond-gen-svg nil "Image generation (SVG) can be turned on by default by setting -LY-GEN-SVG to t") +ORG-BABEL-LILYPOND-GEN-SVG to t") -(defvar ly-gen-html nil +(defvar org-babel-lilypond-gen-html nil "HTML generation can be turned on by default by setting -LY-GEN-HTML to t") +ORG-BABEL-LILYPOND-GEN-HTML to t") -(defvar ly-gen-pdf nil +(defvar org-babel-lilypond-gen-pdf nil "PDF generation can be turned on by default by setting -LY-GEN-PDF to t") +ORG-BABEL-LILYPOND-GEN-PDF to t") -(defvar ly-use-eps nil +(defvar org-babel-lilypond-use-eps nil "You can force the compiler to use the EPS backend by setting -LY-USE-EPS to t") +ORG-BABEL-LILYPOND-USE-EPS to t") -(defvar ly-arrange-mode nil - "Arrange mode is turned on by setting LY-ARRANGE-MODE +(defvar org-babel-lilypond-arrange-mode nil + "Arrange mode is turned on by setting ORG-BABEL-LILYPOND-ARRANGE-MODE to t. In Arrange mode the following settings are altered from default... :tangle yes, :noweb yes @@ -123,20 +123,20 @@ 1. Attempt to execute lilypond block according to header settings (This is the default basic mode) 2. Tangle all lilypond blocks and process the result (arrange mode)" - (ly-set-header-args ly-arrange-mode) - (if ly-arrange-mode - (ly-tangle) - (ly-process-basic body params))) + (org-babel-lilypond-set-header-args org-babel-lilypond-arrange-mode) + (if org-babel-lilypond-arrange-mode + (org-babel-lilypond-tangle) + (org-babel-lilypond-process-basic body params))) -(defun ly-tangle () +(defun org-babel-lilypond-tangle () "ob-lilypond specific tangle, attempts to invoke =ly-execute-tangled-ly= if tangle is successful. Also passes specific arguments to =org-babel-tangle=" (interactive) (if (org-babel-tangle nil "yes" "lilypond") - (ly-execute-tangled-ly) nil)) + (org-babel-lilypond-execute-tangled-ly) nil)) -(defun ly-process-basic (body params) +(defun org-babel-lilypond-process-basic (body params) "Execute a lilypond block in basic mode." (let* ((result-params (cdr (assoc :result-params params))) (out-file (cdr (assoc :file params))) @@ -148,7 +148,7 @@ (insert (org-babel-expand-body:generic body params))) (org-babel-eval (concat - (ly-determine-ly-path) + (org-babel-lilypond-determine-ly-path) " -dbackend=eps " "-dno-gs-load-fonts " "-dinclude-eps-fonts " @@ -167,45 +167,45 @@ "Return an error because LilyPond exporter does not support sessions." (error "Sorry, LilyPond does not currently support sessions!")) -(defun ly-execute-tangled-ly () +(defun org-babel-lilypond-execute-tangled-ly () "Compile result of block tangle with lilypond. If error in compilation, attempt to mark the error in lilypond org file" - (when ly-compile-post-tangle - (let ((ly-tangled-file (ly-switch-extension + (when org-babel-lilypond-compile-post-tangle + (let ((org-babel-lilypond-tangled-file (org-babel-lilypond-switch-extension (buffer-file-name) ".lilypond")) - (ly-temp-file (ly-switch-extension + (org-babel-lilypond-temp-file (org-babel-lilypond-switch-extension (buffer-file-name) ".ly"))) - (if (file-exists-p ly-tangled-file) + (if (file-exists-p org-babel-lilypond-tangled-file) (progn - (when (file-exists-p ly-temp-file) - (delete-file ly-temp-file)) - (rename-file ly-tangled-file - ly-temp-file)) + (when (file-exists-p org-babel-lilypond-temp-file) + (delete-file org-babel-lilypond-temp-file)) + (rename-file org-babel-lilypond-tangled-file + org-babel-lilypond-temp-file)) (error "Error: Tangle Failed!") t) (switch-to-buffer-other-window "*lilypond*") (erase-buffer) - (ly-compile-lilyfile ly-temp-file) + (org-babel-lilypond-compile-lilyfile org-babel-lilypond-temp-file) (goto-char (point-min)) - (if (not (ly-check-for-compile-error ly-temp-file)) + (if (not (org-babel-lilypond-check-for-compile-error org-babel-lilypond-temp-file)) (progn (other-window -1) - (ly-attempt-to-open-pdf ly-temp-file) - (ly-attempt-to-play-midi ly-temp-file)) + (org-babel-lilypond-attempt-to-open-pdf org-babel-lilypond-temp-file) + (org-babel-lilypond-attempt-to-play-midi org-babel-lilypond-temp-file)) (error "Error in Compilation!")))) nil) -(defun ly-compile-lilyfile (file-name &optional test) +(defun org-babel-lilypond-compile-lilyfile (file-name &optional test) "Compile lilypond file and check for compile errors FILE-NAME is full path to lilypond (.ly) file" (message "Compiling LilyPond...") - (let ((arg-1 (ly-determine-ly-path)) ;program + (let ((arg-1 (org-babel-lilypond-determine-ly-path)) ;program (arg-2 nil) ;infile (arg-3 "*lilypond*") ;buffer (arg-4 t) ;display - (arg-5 (if ly-gen-png "--png" "")) ;&rest... - (arg-6 (if ly-gen-html "--html" "")) - (arg-7 (if ly-gen-pdf "--pdf" "")) - (arg-8 (if ly-use-eps "-dbackend=eps" "")) - (arg-9 (if ly-gen-svg "-dbackend=svg" "")) + (arg-5 (if org-babel-lilypond-gen-png "--png" "")) ;&rest... + (arg-6 (if org-babel-lilypond-gen-html "--html" "")) + (arg-7 (if org-babel-lilypond-gen-pdf "--pdf" "")) + (arg-8 (if org-babel-lilypond-use-eps "-dbackend=eps" "")) + (arg-9 (if org-babel-lilypond-gen-svg "-dbackend=svg" "")) (arg-10 (concat "--output=" (file-name-sans-extension file-name))) (arg-11 file-name)) (if test @@ -215,7 +215,7 @@ arg-1 arg-2 arg-3 arg-4 arg-5 arg-6 arg-7 arg-8 arg-9 arg-10 arg-11)))) -(defun ly-check-for-compile-error (file-name &optional test) +(defun org-babel-lilypond-check-for-compile-error (file-name &optional test) "Check for compile error. This is performed by parsing the *lilypond* buffer containing the output message from the compilation. @@ -226,24 +226,24 @@ (if (not test) (if (not is-error) nil - (ly-process-compile-error file-name)) + (org-babel-lilypond-process-compile-error file-name)) is-error))) -(defun ly-process-compile-error (file-name) +(defun org-babel-lilypond-process-compile-error (file-name) "Process the compilation error that has occurred. FILE-NAME is full path to lilypond file" - (let ((line-num (ly-parse-line-num))) - (let ((error-lines (ly-parse-error-line file-name line-num))) - (ly-mark-error-line file-name error-lines) + (let ((line-num (org-babel-lilypond-parse-line-num))) + (let ((error-lines (org-babel-lilypond-parse-error-line file-name line-num))) + (org-babel-lilypond-mark-error-line file-name error-lines) (error "Error: Compilation Failed!")))) -(defun ly-mark-error-line (file-name line) +(defun org-babel-lilypond-mark-error-line (file-name line) "Mark the erroneous lines in the lilypond org buffer. FILE-NAME is full path to lilypond file. LINE is the erroneous line" (switch-to-buffer-other-window (concat (file-name-nondirectory - (ly-switch-extension file-name ".org")))) + (org-babel-lilypond-switch-extension file-name ".org")))) (let ((temp (point))) (goto-char (point-min)) (setq case-fold-search nil) @@ -254,7 +254,7 @@ (goto-char (- (point) (length line)))) (goto-char temp)))) -(defun ly-parse-line-num (&optional buffer) +(defun org-babel-lilypond-parse-line-num (&optional buffer) "Extract error line number." (when buffer (set-buffer buffer)) @@ -276,12 +276,12 @@ nil))) nil))) -(defun ly-parse-error-line (file-name lineNo) +(defun org-babel-lilypond-parse-error-line (file-name lineNo) "Extract the erroneous line from the tangled .ly file FILE-NAME is full path to lilypond file. LINENO is the number of the erroneous line" (with-temp-buffer - (insert-file-contents (ly-switch-extension file-name ".ly") + (insert-file-contents (org-babel-lilypond-switch-extension file-name ".ly") nil nil nil t) (if (> lineNo 0) (progn @@ -290,128 +290,128 @@ (buffer-substring (point) (point-at-eol))) nil))) -(defun ly-attempt-to-open-pdf (file-name &optional test) +(defun org-babel-lilypond-attempt-to-open-pdf (file-name &optional test) "Attempt to display the generated pdf file FILE-NAME is full path to lilypond file If TEST is non-nil, the shell command is returned and is not run" - (when ly-display-pdf-post-tangle - (let ((pdf-file (ly-switch-extension file-name ".pdf"))) + (when org-babel-lilypond-display-pdf-post-tangle + (let ((pdf-file (org-babel-lilypond-switch-extension file-name ".pdf"))) (if (file-exists-p pdf-file) (let ((cmd-string - (concat (ly-determine-pdf-path) " " pdf-file))) + (concat (org-babel-lilypond-determine-pdf-path) " " pdf-file))) (if test cmd-string (start-process "\"Audition pdf\"" "*lilypond*" - (ly-determine-pdf-path) + (org-babel-lilypond-determine-pdf-path) pdf-file))) (message "No pdf file generated so can't display!"))))) -(defun ly-attempt-to-play-midi (file-name &optional test) +(defun org-babel-lilypond-attempt-to-play-midi (file-name &optional test) "Attempt to play the generated MIDI file FILE-NAME is full path to lilypond file If TEST is non-nil, the shell command is returned and is not run" - (when ly-play-midi-post-tangle - (let ((midi-file (ly-switch-extension file-name ".midi"))) + (when org-babel-lilypond-play-midi-post-tangle + (let ((midi-file (org-babel-lilypond-switch-extension file-name ".midi"))) (if (file-exists-p midi-file) (let ((cmd-string - (concat (ly-determine-midi-path) " " midi-file))) + (concat (org-babel-lilypond-determine-midi-path) " " midi-file))) (if test cmd-string (start-process "\"Audition midi\"" "*lilypond*" - (ly-determine-midi-path) + (org-babel-lilypond-determine-midi-path) midi-file))) (message "No midi file generated so can't play!"))))) -(defun ly-determine-ly-path (&optional test) +(defun org-babel-lilypond-determine-ly-path (&optional test) "Return correct path to ly binary depending on OS If TEST is non-nil, it contains a simulation of the OS for test purposes" (let ((sys-type (or test system-type))) (cond ((string= sys-type "darwin") - ly-OSX-ly-path) + org-babel-lilypond-OSX-ly-path) ((string= sys-type "windows-nt") - ly-w32-ly-path) - (t ly-nix-ly-path)))) + org-babel-lilypond-w32-ly-path) + (t org-babel-lilypond-nix-ly-path)))) -(defun ly-determine-pdf-path (&optional test) +(defun org-babel-lilypond-determine-pdf-path (&optional test) "Return correct path to pdf viewer depending on OS If TEST is non-nil, it contains a simulation of the OS for test purposes" (let ((sys-type (or test system-type))) (cond ((string= sys-type "darwin") - ly-OSX-pdf-path) + org-babel-lilypond-OSX-pdf-path) ((string= sys-type "windows-nt") - ly-w32-pdf-path) - (t ly-nix-pdf-path)))) + org-babel-lilypond-w32-pdf-path) + (t org-babel-lilypond-nix-pdf-path)))) -(defun ly-determine-midi-path (&optional test) +(defun org-babel-lilypond-determine-midi-path (&optional test) "Return correct path to midi player depending on OS If TEST is non-nil, it contains a simulation of the OS for test purposes" (let ((sys-type (or test test system-type))) (cond ((string= sys-type "darwin") - ly-OSX-midi-path) + org-babel-lilypond-OSX-midi-path) ((string= sys-type "windows-nt") - ly-w32-midi-path) - (t ly-nix-midi-path)))) + org-babel-lilypond-w32-midi-path) + (t org-babel-lilypond-nix-midi-path)))) -(defun ly-toggle-midi-play () +(defun org-babel-lilypond-toggle-midi-play () "Toggle whether midi will be played following a successful compilation." (interactive) - (setq ly-play-midi-post-tangle - (not ly-play-midi-post-tangle)) + (setq org-babel-lilypond-play-midi-post-tangle + (not org-babel-lilypond-play-midi-post-tangle)) (message (concat "Post-Tangle MIDI play has been " - (if ly-play-midi-post-tangle + (if org-babel-lilypond-play-midi-post-tangle "ENABLED." "DISABLED.")))) -(defun ly-toggle-pdf-display () +(defun org-babel-lilypond-toggle-pdf-display () "Toggle whether pdf will be displayed following a successful compilation." (interactive) - (setq ly-display-pdf-post-tangle - (not ly-display-pdf-post-tangle)) + (setq org-babel-lilypond-display-pdf-post-tangle + (not org-babel-lilypond-display-pdf-post-tangle)) (message (concat "Post-Tangle PDF display has been " - (if ly-display-pdf-post-tangle + (if org-babel-lilypond-display-pdf-post-tangle "ENABLED." "DISABLED.")))) -(defun ly-toggle-png-generation () +(defun org-babel-lilypond-toggle-png-generation () "Toggle whether png image will be generated by compilation." (interactive) - (setq ly-gen-png (not ly-gen-png)) + (setq org-babel-lilypond-gen-png (not org-babel-lilypond-gen-png)) (message (concat "PNG image generation has been " - (if ly-gen-png "ENABLED." "DISABLED.")))) + (if org-babel-lilypond-gen-png "ENABLED." "DISABLED.")))) -(defun ly-toggle-html-generation () +(defun org-babel-lilypond-toggle-html-generation () "Toggle whether html will be generated by compilation." (interactive) - (setq ly-gen-html (not ly-gen-html)) + (setq org-babel-lilypond-gen-html (not org-babel-lilypond-gen-html)) (message (concat "HTML generation has been " - (if ly-gen-html "ENABLED." "DISABLED.")))) + (if org-babel-lilypond-gen-html "ENABLED." "DISABLED.")))) -(defun ly-toggle-pdf-generation () +(defun org-babel-lilypond-toggle-pdf-generation () "Toggle whether pdf will be generated by compilation." (interactive) - (setq ly-gen-pdf (not ly-gen-pdf)) + (setq org-babel-lilypond-gen-pdf (not org-babel-lilypond-gen-pdf)) (message (concat "PDF generation has been " - (if ly-gen-pdf "ENABLED." "DISABLED.")))) + (if org-babel-lilypond-gen-pdf "ENABLED." "DISABLED.")))) -(defun ly-toggle-arrange-mode () +(defun org-babel-lilypond-toggle-arrange-mode () "Toggle whether in Arrange mode or Basic mode." (interactive) - (setq ly-arrange-mode - (not ly-arrange-mode)) + (setq org-babel-lilypond-arrange-mode + (not org-babel-lilypond-arrange-mode)) (message (concat "Arrange mode has been " - (if ly-arrange-mode "ENABLED." "DISABLED.")))) + (if org-babel-lilypond-arrange-mode "ENABLED." "DISABLED.")))) -(defun ly-switch-extension (file-name ext) +(defun org-babel-lilypond-switch-extension (file-name ext) "Utility command to swap current FILE-NAME extension with EXT" (concat (file-name-sans-extension file-name) ext)) -(defun ly-get-header-args (mode) +(defun org-babel-lilypond-get-header-args (mode) "Default arguments to use when evaluating a lilypond source block. These depend upon whether we are in arrange mode i.e. ARRANGE-MODE is t" @@ -425,11 +425,11 @@ '((:results . "file") (:exports . "results"))))) -(defun ly-set-header-args (mode) +(defun org-babel-lilypond-set-header-args (mode) "Set org-babel-default-header-args:lilypond -dependent on LY-ARRANGE-MODE" +dependent on ORG-BABEL-LILYPOND-ARRANGE-MODE" (setq org-babel-default-header-args:lilypond - (ly-get-header-args mode))) + (org-babel-lilypond-get-header-args mode))) (provide 'ob-lilypond) === modified file 'lisp/org/ob-python.el' --- lisp/org/ob-python.el 2014-04-22 14:07:45 +0000 +++ lisp/org/ob-python.el 2014-10-03 08:13:51 +0000 @@ -56,8 +56,6 @@ :package-version '(Org . "8.0") :type 'symbol) -(defvar org-src-preserve-indentation) - (defcustom org-babel-python-hline-to "None" "Replace hlines in incoming tables with this when translating to python." :group 'org-babel === modified file 'lisp/org/ob-sh.el' --- lisp/org/ob-sh.el 2014-01-01 07:43:34 +0000 +++ lisp/org/ob-sh.el 2014-10-03 08:13:51 +0000 @@ -123,7 +123,13 @@ (when (and session (not (string= session "none"))) (save-window-excursion (or (org-babel-comint-buffer-livep session) - (progn (shell session) (get-buffer (current-buffer))))))) + (progn + (shell session) + ;; Needed for Emacs 23 since the marker is initially + ;; undefined and the filter functions try to use it without + ;; checking. + (set-marker comint-last-output-start (point)) + (get-buffer (current-buffer))))))) (defvar org-babel-sh-eoe-indicator "echo 'org_babel_sh_eoe'" "String to indicate that evaluation has completed.") === modified file 'lisp/org/ob-tangle.el' --- lisp/org/ob-tangle.el 2014-01-01 07:43:34 +0000 +++ lisp/org/ob-tangle.el 2014-10-03 08:13:51 +0000 @@ -225,13 +225,14 @@ (concat base-name "." ext) base-name)))) (when file-name ;; Possibly create the parent directories for file. - (when (let ((m (funcall get-spec :mkdirp))) - (and m (not (string= m "no")))) - (make-directory (file-name-directory file-name) 'parents)) + (let ((m (funcall get-spec :mkdirp)) + (fnd (file-name-directory file-name))) + (and m fnd (not (string= m "no")) + (make-directory fnd 'parents))) ;; delete any old versions of file - (when (and (file-exists-p file-name) - (not (member file-name (mapcar #'car path-collector)))) - (delete-file file-name)) + (and (file-exists-p file-name) + (not (member file-name (mapcar #'car path-collector))) + (delete-file file-name)) ;; drop source-block to file (with-temp-buffer (when (fboundp lang-f) (ignore-errors (funcall lang-f))) === modified file 'lisp/org/org-agenda.el' --- lisp/org/org-agenda.el 2014-04-22 14:07:45 +0000 +++ lisp/org/org-agenda.el 2014-10-03 08:13:51 +0000 @@ -390,32 +390,36 @@ (repeat :inline t :tag "Conditions for skipping" (choice :tag "Condition type" - (list :tag "Regexp matches" :inline t (const :format "" regexp) (regexp)) - (list :tag "Regexp does not match" :inline t (const :format "" notregexp) (regexp)) + (list :tag "Regexp matches" :inline t + (const :format "" 'regexp) + (regexp)) + (list :tag "Regexp does not match" :inline t + (const :format "" 'notregexp) + (regexp)) (list :tag "TODO state is" :inline t - (const todo) + (const 'todo) (choice - (const :tag "any not-done state" todo) - (const :tag "any done state" done) - (const :tag "any state" any) + (const :tag "Any not-done state" 'todo) + (const :tag "Any done state" 'done) + (const :tag "Any state" 'any) (list :tag "Keyword list" (const :format "" quote) (repeat (string :tag "Keyword"))))) (list :tag "TODO state is not" :inline t - (const nottodo) + (const 'nottodo) (choice - (const :tag "any not-done state" todo) - (const :tag "any done state" done) - (const :tag "any state" any) + (const :tag "Any not-done state" 'todo) + (const :tag "Any done state" 'done) + (const :tag "Any state" 'any) (list :tag "Keyword list" (const :format "" quote) (repeat (string :tag "Keyword"))))) - (const :tag "scheduled" scheduled) - (const :tag "not scheduled" notscheduled) - (const :tag "deadline" deadline) - (const :tag "no deadline" notdeadline) - (const :tag "timestamp" timestamp) - (const :tag "no timestamp" nottimestamp)))))) + (const :tag "scheduled" 'scheduled) + (const :tag "not scheduled" 'notscheduled) + (const :tag "deadline" 'deadline) + (const :tag "no deadline" 'notdeadline) + (const :tag "timestamp" 'timestamp) + (const :tag "no timestamp" 'nottimestamp)))))) (list :tag "Non-standard skipping condition" :value (org-agenda-skip-function) (const org-agenda-skip-function) @@ -2092,11 +2096,9 @@ org-agenda-info org-agenda-pre-window-conf org-agenda-columns-active - org-agenda-tag-filter-overlays org-agenda-tag-filter - org-agenda-cat-filter-overlays org-agenda-category-filter - org-agenda-re-filter-overlays + org-agenda-top-headline-filter org-agenda-regexp-filter org-agenda-markers org-agenda-last-search-view-search-was-boolean @@ -2158,10 +2160,11 @@ nil t) (unless org-agenda-keep-modes (setq org-agenda-follow-mode org-agenda-start-with-follow-mode - org-agenda-entry-text-mode org-agenda-start-with-entry-text-mode - org-agenda-clockreport-mode org-agenda-start-with-clockreport-mode - org-agenda-show-log org-agenda-start-with-log-mode)) - + org-agenda-entry-text-mode org-agenda-start-with-entry-text-mode)) + (setq org-agenda-show-log org-agenda-start-with-log-mode) + (setq org-agenda-clockreport-mode org-agenda-start-with-clockreport-mode) + (add-to-invisibility-spec '(org-filtered)) + (add-to-invisibility-spec '(org-link)) (easy-menu-change '("Agenda") "Agenda Files" (append @@ -2604,7 +2607,7 @@ :package-version '(Org . "8.0") :group 'org-agenda-custom-commands :type '(choice (symbol :tag "No limit" nil) - (integer :tag "Max number of entries") + (integer :tag "Max number of TODOs") (repeat (cons (choice :tag "Agenda type" (const agenda) @@ -2612,7 +2615,7 @@ (const tags) (const search) (const timeline)) - (integer :tag "Max number of entries"))))) + (integer :tag "Max number of TODOs"))))) (defcustom org-agenda-max-tags nil "Maximum number of tagged entries to display in an agenda. @@ -2623,7 +2626,7 @@ :package-version '(Org . "8.0") :group 'org-agenda-custom-commands :type '(choice (symbol :tag "No limit" nil) - (integer :tag "Max number of entries") + (integer :tag "Max number of tagged entries") (repeat (cons (choice :tag "Agenda type" (const agenda) @@ -2631,7 +2634,7 @@ (const tags) (const search) (const timeline)) - (integer :tag "Max number of entries"))))) + (integer :tag "Max number of tagged entries"))))) (defcustom org-agenda-max-effort nil "Maximum cumulated effort duration for the agenda. @@ -2642,7 +2645,7 @@ :package-version '(Org . "8.0") :group 'org-agenda-custom-commands :type '(choice (symbol :tag "No limit" nil) - (integer :tag "Max number of entries") + (integer :tag "Max number of minutes") (repeat (cons (choice :tag "Agenda type" (const agenda) @@ -2650,7 +2653,7 @@ (const tags) (const search) (const timeline)) - (integer :tag "Max number of entries"))))) + (integer :tag "Max number of minutes"))))) (defvar org-keys nil) (defvar org-match nil) @@ -3324,19 +3327,12 @@ (org-let (if nosettings nil org-agenda-exporter-settings) '(save-excursion (save-window-excursion - (org-agenda-mark-filtered-text) (let ((bs (copy-sequence (buffer-string))) beg content) - (org-agenda-unmark-filtered-text) (with-temp-buffer (rename-buffer org-agenda-write-buffer-name t) (set-buffer-modified-p nil) (insert bs) (org-agenda-remove-marked-text 'org-filtered) - (while (setq beg (text-property-any (point-min) (point-max) - 'org-filtered t)) - (delete-region - beg (or (next-single-property-change beg 'org-filtered) - (point-max)))) (run-hooks 'org-agenda-before-write-hook) (cond ((org-bound-and-true-p org-mobile-creating-agendas) @@ -3356,7 +3352,7 @@ content))) (find-file file) (erase-buffer) - (mapcar (lambda (s) (org-paste-subtree 1 s)) (reverse content)) + (dolist (s content) (org-paste-subtree 1 s)) (write-file file) (kill-buffer (current-buffer)) (message "Org file written to %s" file))) @@ -3402,28 +3398,6 @@ org-agenda-buffer-name))) (when open (org-open-file file))) -(defvar org-agenda-tag-filter-overlays nil) -(defvar org-agenda-cat-filter-overlays nil) -(defvar org-agenda-re-filter-overlays nil) - -(defun org-agenda-mark-filtered-text () - "Mark all text hidden by filtering with a text property." - (let ((inhibit-read-only t)) - (mapc - (lambda (o) - (when (equal (overlay-buffer o) (current-buffer)) - (put-text-property - (overlay-start o) (overlay-end o) - 'org-filtered t))) - (append org-agenda-tag-filter-overlays - org-agenda-cat-filter-overlays - org-agenda-re-filter-overlays)))) - -(defun org-agenda-unmark-filtered-text () - "Remove the filtering text property." - (let ((inhibit-read-only t)) - (remove-text-properties (point-min) (point-max) '(org-filtered t)))) - (defun org-agenda-remove-marked-text (property &optional value) "Delete all text marked with VALUE of PROPERTY. VALUE defaults to t." @@ -3432,7 +3406,7 @@ (while (setq beg (text-property-any (point-min) (point-max) property value)) (delete-region - beg (or (next-single-property-change beg 'org-filtered) + beg (or (next-single-property-change beg property) (point-max)))))) (defun org-agenda-add-entry-text () @@ -3557,7 +3531,6 @@ (defvar org-agenda-category-filter nil) (defvar org-agenda-regexp-filter nil) (defvar org-agenda-top-headline-filter nil) -(defvar org-agenda-tag-filter-while-redo nil) (defvar org-agenda-tag-filter-preset nil "A preset of the tags filter used for secondary agenda filtering. This must be a list of strings, each string must be a single tag preceded @@ -3609,10 +3582,12 @@ ;; does not have org variables local org-agenda-this-buffer-is-sticky)))) -(defun org-agenda-prepare-window (abuf) - "Setup agenda buffer in the window." - (let* ((awin (get-buffer-window abuf)) - wconf) +(defun org-agenda-prepare-window (abuf filter-alist) + "Setup agenda buffer in the window. +ABUF is the buffer for the agenda window. +FILTER-ALIST is an alist of filters we need to apply when +`org-agenda-persistent-filter' is non-nil." + (let* ((awin (get-buffer-window abuf)) wconf) (cond ((equal (current-buffer) abuf) nil) (awin (select-window awin)) @@ -3626,68 +3601,76 @@ ((equal org-agenda-window-setup 'reorganize-frame) (delete-other-windows) (org-switch-to-buffer-other-window abuf))) - ;; additional test in case agenda is invoked from within agenda - ;; buffer via elisp link + (setq org-agenda-tag-filter (cdr (assoc 'tag filter-alist))) + (setq org-agenda-category-filter (cdr (assoc 'cat filter-alist))) + (setq org-agenda-regexp-filter (cdr (assoc 're filter-alist))) + ;; Additional test in case agenda is invoked from within agenda + ;; buffer via elisp link. (unless (equal (current-buffer) abuf) (org-pop-to-buffer-same-window abuf)) (setq org-agenda-pre-window-conf (or org-agenda-pre-window-conf wconf)))) (defun org-agenda-prepare (&optional name) - (if (org-agenda-use-sticky-p) - (progn - ;; Popup existing buffer - (org-agenda-prepare-window (get-buffer org-agenda-buffer-name)) - (message "Sticky Agenda buffer, use `r' to refresh") - (or org-agenda-multi (org-agenda-fit-window-to-buffer)) - (throw 'exit "Sticky Agenda buffer, use `r' to refresh")) - (setq org-todo-keywords-for-agenda nil) - (setq org-drawers-for-agenda nil) - (unless org-agenda-persistent-filter - (setq org-agenda-tag-filter nil - org-agenda-category-filter nil - org-agenda-regexp-filter nil)) - (put 'org-agenda-tag-filter :preset-filter - org-agenda-tag-filter-preset) - (put 'org-agenda-category-filter :preset-filter - org-agenda-category-filter-preset) - (put 'org-agenda-regexp-filter :preset-filter - org-agenda-regexp-filter-preset) - (if org-agenda-multi + (let ((filter-alist (if org-agenda-persistent-filter + (list `(tag . ,org-agenda-tag-filter) + `(re . ,org-agenda-regexp-filter) + `(car . ,org-agenda-category-filter))))) + (if (org-agenda-use-sticky-p) (progn - (setq buffer-read-only nil) - (goto-char (point-max)) - (unless (or (bobp) org-agenda-compact-blocks - (not org-agenda-block-separator)) - (insert "\n" - (if (stringp org-agenda-block-separator) - org-agenda-block-separator - (make-string (window-width) org-agenda-block-separator)) - "\n")) - (narrow-to-region (point) (point-max))) - (setq org-done-keywords-for-agenda nil) + (put 'org-agenda-tag-filter :preset-filter nil) + (put 'org-agenda-category-filter :preset-filter nil) + (put 'org-agenda-regexp-filter :preset-filter nil) + ;; Popup existing buffer + (org-agenda-prepare-window (get-buffer org-agenda-buffer-name) + filter-alist) + (message "Sticky Agenda buffer, use `r' to refresh") + (or org-agenda-multi (org-agenda-fit-window-to-buffer)) + (throw 'exit "Sticky Agenda buffer, use `r' to refresh")) + (setq org-todo-keywords-for-agenda nil) + (setq org-drawers-for-agenda nil) + (put 'org-agenda-tag-filter :preset-filter + org-agenda-tag-filter-preset) + (put 'org-agenda-category-filter :preset-filter + org-agenda-category-filter-preset) + (put 'org-agenda-regexp-filter :preset-filter + org-agenda-regexp-filter-preset) + (if org-agenda-multi + (progn + (setq buffer-read-only nil) + (goto-char (point-max)) + (unless (or (bobp) org-agenda-compact-blocks + (not org-agenda-block-separator)) + (insert "\n" + (if (stringp org-agenda-block-separator) + org-agenda-block-separator + (make-string (window-width) org-agenda-block-separator)) + "\n")) + (narrow-to-region (point) (point-max))) + (setq org-done-keywords-for-agenda nil) - ;; Setting any org variables that are in org-agenda-local-vars - ;; list need to be done after the prepare call - (org-agenda-prepare-window (get-buffer-create org-agenda-buffer-name)) - (setq buffer-read-only nil) - (org-agenda-reset-markers) - (let ((inhibit-read-only t)) (erase-buffer)) - (org-agenda-mode) - (setq org-agenda-buffer (current-buffer)) - (setq org-agenda-contributing-files nil) - (setq org-agenda-columns-active nil) - (org-agenda-prepare-buffers (org-agenda-files nil 'ifmode)) - (setq org-todo-keywords-for-agenda - (org-uniquify org-todo-keywords-for-agenda)) - (setq org-done-keywords-for-agenda - (org-uniquify org-done-keywords-for-agenda)) - (setq org-drawers-for-agenda (org-uniquify org-drawers-for-agenda)) - (setq org-agenda-last-prefix-arg current-prefix-arg) - (setq org-agenda-this-buffer-name org-agenda-buffer-name) - (and name (not org-agenda-name) - (org-set-local 'org-agenda-name name))) - (setq buffer-read-only nil))) + ;; Setting any org variables that are in org-agenda-local-vars + ;; list need to be done after the prepare call + (org-agenda-prepare-window + (get-buffer-create org-agenda-buffer-name) filter-alist) + (setq buffer-read-only nil) + (org-agenda-reset-markers) + (let ((inhibit-read-only t)) (erase-buffer)) + (org-agenda-mode) + (setq org-agenda-buffer (current-buffer)) + (setq org-agenda-contributing-files nil) + (setq org-agenda-columns-active nil) + (org-agenda-prepare-buffers (org-agenda-files nil 'ifmode)) + (setq org-todo-keywords-for-agenda + (org-uniquify org-todo-keywords-for-agenda)) + (setq org-done-keywords-for-agenda + (org-uniquify org-done-keywords-for-agenda)) + (setq org-drawers-for-agenda (org-uniquify org-drawers-for-agenda)) + (setq org-agenda-last-prefix-arg current-prefix-arg) + (setq org-agenda-this-buffer-name org-agenda-buffer-name) + (and name (not org-agenda-name) + (org-set-local 'org-agenda-name name))) + (setq buffer-read-only nil)))) (defvar org-agenda-overriding-columns-format) ; From org-colview.el (defun org-agenda-finalize () @@ -3739,13 +3722,15 @@ (save-excursion (goto-char (point-min)) (while (equal (forward-line) 0) - (when (setq mrk (or (get-text-property (point) 'org-hd-marker) - (get-text-property (point) 'org-hd-marker))) + (when (setq mrk (get-text-property (point) 'org-hd-marker)) (put-text-property (point-at-bol) (point-at-eol) 'tags (org-with-point-at mrk (delete-dups (mapcar 'downcase (org-get-tags-at)))))))))) (run-hooks 'org-agenda-finalize-hook) + (when org-agenda-top-headline-filter + (org-agenda-filter-top-headline-apply + org-agenda-top-headline-filter)) (when org-agenda-tag-filter (org-agenda-filter-apply org-agenda-tag-filter 'tag)) (when (get 'org-agenda-tag-filter :preset-filter) @@ -4326,14 +4311,6 @@ (setq p (plist-put p :tstart clocktable-start)) (setq p (plist-put p :tend clocktable-end)) (setq p (plist-put p :scope 'agenda)) - (when (and (eq org-agenda-clockreport-mode 'with-filter) - (setq filter (or org-agenda-tag-filter-while-redo - (get 'org-agenda-tag-filter :preset-filter)))) - (setq p (plist-put p :tags (mapconcat (lambda (x) - (if (string-match "[<>=]" x) - "" - x)) - filter "")))) (setq tbl (apply 'org-clock-get-clocktable p)) (insert tbl))) (goto-char (point-min)) @@ -5703,7 +5680,7 @@ (setq txt (org-agenda-format-item extra txt level category tags 'time)) (org-add-props txt props 'org-marker marker 'org-category category 'date date 'todo-state todo-state - 'org-category-position category-pos 'tags tags + 'org-category-position category-pos 'level level 'type "sexp" 'warntime warntime) (push txt ee))))) @@ -6781,8 +6758,10 @@ HH:MM." (save-match-data (when - (or (string-match "\\<\\([012]?[0-9]\\)\\(:\\([0-5][0-9]\\)\\)\\([AaPp][Mm]\\)?\\> *" s) - (string-match "\\<\\([012]?[0-9]\\)\\(:\\([0-5][0-9]\\)\\)?\\([AaPp][Mm]\\)\\> *" s)) + (and + (or (string-match "\\<\\([012]?[0-9]\\)\\(:\\([0-5][0-9]\\)\\)\\([AaPp][Mm]\\)?\\> *" s) + (string-match "\\<\\([012]?[0-9]\\)\\(:\\([0-5][0-9]\\)\\)?\\([AaPp][Mm]\\)\\> *" s)) + (not (eq (get-text-property 1 'face s) 'org-link))) (let* ((h (string-to-number (match-string 1 s))) (m (if (match-end 3) (string-to-number (match-string 3 s)) 0)) (ampm (if (match-end 4) (downcase (match-string 4 s)))) @@ -7010,7 +6989,7 @@ (cond ((< ta tb) -1) ((< tb ta) +1)))) -(defsubst org-cmp-ts (a b &optional type) +(defsubst org-cmp-ts (a b type) "Compare the timestamps values of entries A and B. When TYPE is \"scheduled\", \"deadline\", \"timestamp\" or \"timestamp_ia\", compare within each of these type. When TYPE @@ -7018,9 +6997,11 @@ their type." (let* ((def (if org-sort-agenda-notime-is-late most-positive-fixnum -1)) (ta (or (and (string-match type (or (get-text-property 1 'type a) "")) - (get-text-property 1 'ts-date a)) def)) + (get-text-property 1 'ts-date a)) + def)) (tb (or (and (string-match type (or (get-text-property 1 'type b) "")) - (get-text-property 1 'ts-date b)) def))) + (get-text-property 1 'ts-date b)) + def))) (cond ((< ta tb) -1) ((< tb ta) +1)))) @@ -7046,7 +7027,7 @@ (org-cmp-ts a b "deadline"))) (deadline-down (if deadline-up (- deadline-up) nil)) (tsia-up (and (org-em 'tsia-up 'tsia-down ss) - (org-cmp-ts a b "iatimestamp_ia"))) + (org-cmp-ts a b "timestamp_ia"))) (tsia-down (if tsia-up (- tsia-up) nil)) (ts-up (and (org-em 'ts-up 'ts-down ss) (org-cmp-ts a b "timestamp"))) @@ -7283,7 +7264,6 @@ (cat-preset (get 'org-agenda-category-filter :preset-filter)) (re-filter org-agenda-regexp-filter) (re-preset (get 'org-agenda-regexp-filter :preset-filter)) - (org-agenda-tag-filter-while-redo (or tag-filter tag-preset)) (cols org-agenda-columns-active) (line (org-current-line)) (window-line (- line (org-current-line (window-start)))) @@ -7316,9 +7296,12 @@ (put 'org-agenda-tag-filter :preset-filter tag-preset) (put 'org-agenda-category-filter :preset-filter cat-preset) (put 'org-agenda-regexp-filter :preset-filter re-preset) - (and (or tag-filter tag-preset) (org-agenda-filter-apply tag-filter 'tag)) - (and (or cat-filter cat-preset) (org-agenda-filter-apply cat-filter 'category)) - (and (or re-filter re-preset) (org-agenda-filter-apply re-filter 'regexp)) + (let ((tag (or tag-filter tag-preset)) + (cat (or cat-filter cat-preset)) + (re (or re-filter re-preset))) + (when tag (org-agenda-filter-apply tag 'tag)) + (when cat (org-agenda-filter-apply cat 'category)) + (when re (org-agenda-filter-apply re 'regexp))) (and top-hl-filter (org-agenda-filter-top-headline-apply top-hl-filter)) (and cols (org-called-interactively-p 'any) (org-agenda-columns)) (org-goto-line line) @@ -7344,7 +7327,7 @@ (org-agenda-filter-apply (setq org-agenda-category-filter (list (concat "+" cat))) 'category)) - ((error "No category at point")))))) + (t (error "No category at point")))))) (defun org-find-top-headline (&optional pos) "Find the topmost parent headline and return it." @@ -7365,10 +7348,10 @@ (progn (setq org-agenda-filtered-by-top-headline nil org-agenda-top-headline-filter nil) - (org-agenda-filter-show-all-cat)) - (let ((cat (org-find-top-headline (org-get-at-bol 'org-hd-marker)))) - (if cat (org-agenda-filter-top-headline-apply cat strip) - (error "No top-level category at point"))))) + (org-agenda-filter-show-all-top-filter)) + (let ((toph (org-find-top-headline (org-get-at-bol 'org-hd-marker)))) + (if toph (org-agenda-filter-top-headline-apply toph strip) + (error "No top-level headline at point"))))) (defvar org-agenda-regexp-filter nil) (defun org-agenda-filter-by-regexp (strip) @@ -7397,7 +7380,10 @@ (when org-agenda-category-filter (org-agenda-filter-show-all-cat)) (when org-agenda-regexp-filter - (org-agenda-filter-show-all-re))) + (org-agenda-filter-show-all-re)) + (when org-agenda-top-headline-filter + (org-agenda-filter-show-all-top-filter)) + (org-agenda-finalize)) (defun org-agenda-filter-by-tag (strip &optional char narrow) "Keep only those lines in the agenda buffer that have a specific tag. @@ -7500,8 +7486,7 @@ (org-agenda-filter-apply org-agenda-tag-filter 'tag) (setq maybe-refresh t)) (t (error "Invalid tag selection character %c" char))) - (when (and maybe-refresh - (eq org-agenda-clockreport-mode 'with-filter)) + (when maybe-refresh (org-agenda-redo)))) (defun org-agenda-get-represented-tags () @@ -7622,13 +7607,12 @@ ;; Deactivate `org-agenda-entry-text-mode' when filtering (if org-agenda-entry-text-mode (org-agenda-entry-text-mode)) (let (tags cat txt) - (setq org-agenda-filter-form - (org-agenda-filter-make-matcher filter type)) - (if (and (eq type 'category) - (not (equal (substring (car filter) 0 1) "-"))) - ;; Only set `org-agenda-filtered-by-category' to t - ;; when a unique category is used as the filter - (setq org-agenda-filtered-by-category t)) + (setq org-agenda-filter-form (org-agenda-filter-make-matcher filter type)) + ;; Only set `org-agenda-filtered-by-category' to t when a unique + ;; category is used as the filter: + (setq org-agenda-filtered-by-category + (and (eq type 'category) + (not (equal (substring (car filter) 0 1) "-")))) (org-agenda-set-mode-name) (save-excursion (goto-char (point-min)) @@ -7659,7 +7643,7 @@ (tophl (and pos (org-find-top-headline pos)))) (if (and tophl (funcall (if negative 'identity 'not) (string= hl tophl))) - (org-agenda-filter-hide-line 'category))) + (org-agenda-filter-hide-line 'top-headline))) (beginning-of-line 2))) (if (get-char-property (point) 'invisible) (org-agenda-previous-line)) @@ -7669,50 +7653,35 @@ (defun org-agenda-filter-hide-line (type) "Hide lines with TYPE in the agenda buffer." (let* ((b (max (point-min) (1- (point-at-bol)))) - (e (point-at-eol)) - (ov (make-overlay b e))) - (overlay-put ov 'invisible t) - (overlay-put ov 'intangible t) - (overlay-put ov 'type type) - (cond ((eq type 'tag) (push ov org-agenda-tag-filter-overlays)) - ((eq type 'category) (push ov org-agenda-cat-filter-overlays)) - ((eq type 'regexp) (push ov org-agenda-re-filter-overlays))))) + (e (point-at-eol))) + (let ((inhibit-read-only t)) + (add-text-properties + b e `(invisible org-filtered org-filter-type ,type))))) -(defun org-agenda-fix-tags-filter-overlays-at (&optional pos) - (setq pos (or pos (point))) +(defun org-agenda-remove-filter (type) + (interactive) + "Remove filter of type TYPE from the agenda buffer." (save-excursion - (dolist (ov (overlays-at pos)) - (when (and (overlay-get ov 'invisible) - (eq (overlay-get ov 'type) 'tag)) + (goto-char (point-min)) + (let ((inhibit-read-only t) pos) + (while (setq pos (text-property-any (point) (point-max) 'org-filter-type type)) (goto-char pos) - (if (< (overlay-start ov) (point-at-eol)) - (move-overlay ov (point-at-eol) - (overlay-end ov))))))) + (remove-text-properties + (point) (next-single-property-change (point) 'org-filter-type) + `(invisible org-filtered org-filter-type ,type)))) + (set (intern (format "org-agenda-%s-filter" (intern-soft type))) nil) + (setq org-agenda-filter-form nil) + (org-agenda-set-mode-name) + (org-agenda-finalize))) (defun org-agenda-filter-show-all-tag nil - "Remove tag filter overlays from the agenda buffer." - (mapc 'delete-overlay org-agenda-tag-filter-overlays) - (setq org-agenda-tag-filter-overlays nil - org-agenda-tag-filter nil - org-agenda-filter-form nil) - (org-agenda-set-mode-name)) - + (org-agenda-remove-filter 'tag)) (defun org-agenda-filter-show-all-re nil - "Remove regexp filter overlays from the agenda buffer." - (mapc 'delete-overlay org-agenda-re-filter-overlays) - (setq org-agenda-re-filter-overlays nil - org-agenda-regexp-filter nil - org-agenda-filter-form nil) - (org-agenda-set-mode-name)) - + (org-agenda-remove-filter 'regexp)) (defun org-agenda-filter-show-all-cat nil - "Remove category filter overlays from the agenda buffer." - (mapc 'delete-overlay org-agenda-cat-filter-overlays) - (setq org-agenda-cat-filter-overlays nil - org-agenda-filtered-by-category nil - org-agenda-category-filter nil - org-agenda-filter-form nil) - (org-agenda-set-mode-name)) + (org-agenda-remove-filter 'category)) +(defun org-agenda-filter-show-all-top-filter nil + (org-agenda-remove-filter 'top-headline)) (defun org-agenda-manipulate-query-add () "Manipulate the query by adding a search term with positive selection. @@ -8106,15 +8075,12 @@ (format " (maximum number of lines is %d)" (if (integerp arg) arg org-agenda-entry-text-maxlines)))))) -(defun org-agenda-clockreport-mode (&optional with-filter) - "Toggle clocktable mode in an agenda buffer. -With prefix arg WITH-FILTER, make the clocktable respect the current -agenda filter." - (interactive "P") +(defun org-agenda-clockreport-mode () + "Toggle clocktable mode in an agenda buffer." + (interactive) (org-agenda-check-type t 'agenda) - (if with-filter - (setq org-agenda-clockreport-mode 'with-filter) - (setq org-agenda-clockreport-mode (not org-agenda-clockreport-mode))) + (setq org-agenda-clockreport-mode (not org-agenda-clockreport-mode)) + (setq org-agenda-start-with-clockreport-mode org-agenda-clockreport-mode) (org-agenda-set-mode-name) (org-agenda-redo) (message "Clocktable mode is %s" @@ -8135,6 +8101,7 @@ nil 'clockcheck)) (special '(closed clock state)) (t (not org-agenda-show-log)))) + (setq org-agenda-start-with-log-mode org-agenda-show-log) (org-agenda-set-mode-name) (org-agenda-redo) (message "Log mode is %s" @@ -8252,10 +8219,7 @@ " Archives" (format " :%s:" org-archive-tag)) "") - (if org-agenda-clockreport-mode - (if (eq org-agenda-clockreport-mode 'with-filter) - " Clock{}" " Clock") - ""))) + (if org-agenda-clockreport-mode " Clock" ""))) (force-mode-line-update)) (define-obsolete-function-alias @@ -8623,7 +8587,8 @@ (interactive "p") (let ((win (selected-window))) (org-agenda-goto t) - (org-recenter-heading 1) + (org-back-to-heading) + (set-window-start (selected-window) (point-at-bol)) (cond ((= more 0) (hide-subtree) @@ -8662,11 +8627,6 @@ (message "Remote: SUBTREE AND ALL DRAWERS"))) (select-window win))) -(defun org-recenter-heading (n) - (save-excursion - (org-back-to-heading) - (recenter n))) - (defvar org-agenda-cycle-counter nil) (defun org-agenda-cycle-show (&optional n) "Show the current entry in another window, with default settings. @@ -9177,8 +9137,6 @@ (when (equal marker (org-get-at-bol 'org-marker)) (remove-text-properties (point-at-bol) (point-at-eol) '(display)) (org-move-to-column (- (window-width) (length stamp)) t) - - (org-agenda-fix-tags-filter-overlays-at (point)) (if (featurep 'xemacs) ;; Use `duplicable' property to trigger undo recording (let ((ex (make-extent nil nil)) @@ -9190,7 +9148,7 @@ (add-text-properties (1- (point)) (point-at-eol) (list 'display (org-add-props stamp nil - 'face 'secondary-selection)))) + 'face '(secondary-selection default))))) (beginning-of-line 1)) (beginning-of-line 0))))) @@ -9478,9 +9436,9 @@ (if org-adapt-indentation (org-indent-to-column 2))) (defun org-agenda-insert-diary-make-new-entry (text) - "Make new entry as last child of current entry. -Add TEXT as headline, and position the cursor in the second line so that -a timestamp can be added there." + "Make a new entry with TEXT as the first child of the current subtree. +Position the point in the line right after the new heading so +that a timestamp can be added there." (let ((org-show-following-heading t) (org-show-siblings t) (org-show-hierarchy-above t) @@ -9669,7 +9627,7 @@ (overlay-put ov 'type 'org-marked-entry-overlay)) (end-of-line 1) (or (ignore-errors - (goto-char (next-single-property-change (point) 'txt))) + (goto-char (next-single-property-change (point) 'org-hd-marker))) (beginning-of-line 2)) (while (and (get-char-property (point) 'invisible) (not (eobp))) (beginning-of-line 2)) @@ -9687,7 +9645,7 @@ (let ((entries-marked 0) txt-at-point) (save-excursion (goto-char (point-min)) - (goto-char (next-single-property-change (point) 'txt)) + (goto-char (next-single-property-change (point) 'org-hd-marker)) (while (and (re-search-forward regexp nil t) (setq txt-at-point (get-text-property (point) 'txt))) (when (string-match regexp txt-at-point) @@ -9723,7 +9681,7 @@ (save-excursion (goto-char (point-min)) (while (ignore-errors - (goto-char (next-single-property-change (point) 'txt))) + (goto-char (next-single-property-change (point) 'org-hd-marker))) (org-agenda-bulk-toggle)))) (defun org-agenda-bulk-toggle () === modified file 'lisp/org/org-attach.el' --- lisp/org/org-attach.el 2014-01-07 13:22:53 +0000 +++ lisp/org/org-attach.el 2014-10-03 08:13:51 +0000 @@ -208,7 +208,9 @@ (save-excursion (save-restriction (widen) - (goto-char org-entry-property-inherited-from) + (if (marker-position org-entry-property-inherited-from) + (goto-char org-entry-property-inherited-from) + (org-back-to-heading t)) (let (org-attach-allow-inheritance) (org-attach-dir create-if-not-exists-p))))) (org-attach-check-absolute-path attach-dir) === modified file 'lisp/org/org-bbdb.el' --- lisp/org/org-bbdb.el 2014-01-01 07:43:34 +0000 +++ lisp/org/org-bbdb.el 2014-10-03 08:13:51 +0000 @@ -400,8 +400,11 @@ (defun org-bbdb-complete-link () "Read a bbdb link with name completion." (require 'bbdb-com) - (concat "bbdb:" - (bbdb-record-name (car (bbdb-completing-read-record "Name: "))))) + (let ((rec (bbdb-completing-read-record "Name: "))) + (concat "bbdb:" + (bbdb-record-name (if (listp rec) + (car rec) + rec))))) (defun org-bbdb-anniv-export-ical () "Extract anniversaries from BBDB and convert them to icalendar format." === modified file 'lisp/org/org-capture.el' --- lisp/org/org-capture.el 2014-04-22 14:07:45 +0000 +++ lisp/org/org-capture.el 2014-10-03 08:13:51 +0000 @@ -1529,8 +1529,8 @@ (v-x (or (org-get-x-clipboard 'PRIMARY) (org-get-x-clipboard 'CLIPBOARD) (org-get-x-clipboard 'SECONDARY))) - (v-t (format-time-string (car org-time-stamp-formats) ct)) - (v-T (format-time-string (cdr org-time-stamp-formats) ct)) + (v-t (format-time-string (car org-time-stamp-formats) ct1)) + (v-T (format-time-string (cdr org-time-stamp-formats) ct1)) (v-u (concat "[" (substring v-t 1 -1) "]")) (v-U (concat "[" (substring v-T 1 -1) "]")) ;; `initial' and `annotation' might habe been passed. @@ -1587,7 +1587,7 @@ (insert template) (goto-char (point-min)) (org-capture-steal-local-variables buffer) - (setq buffer-file-name nil) + (setq buffer-file-name nil mark-active nil) ;; %[] Insert contents of a file. (goto-char (point-min)) @@ -1674,7 +1674,9 @@ (or (equal (char-before) ?:) (insert ":")) (insert ins) (or (equal (char-after) ?:) (insert ":")) - (and (org-at-heading-p) (org-set-tags nil 'align))))) + (and (org-at-heading-p) + (let ((org-ignore-region t)) + (org-set-tags nil 'align)))))) ((equal char "C") (cond ((= (length clipboards) 1) (insert (car clipboards))) ((> (length clipboards) 1) === modified file 'lisp/org/org-clock.el' --- lisp/org/org-clock.el 2014-05-29 03:45:29 +0000 +++ lisp/org/org-clock.el 2014-10-03 15:44:46 +0000 @@ -2556,13 +2556,10 @@ total-time)) (defun org-clocktable-indent-string (level) - (if (= level 1) - "" - (let ((str "\\__")) - (while (> level 2) - (setq level (1- level) - str (concat str "___"))) - (concat str " ")))) + (if (= level 1) "" + (let ((str " ")) + (dotimes (k (1- level) str) + (setq str (concat "\\emsp" str)))))) (defun org-clocktable-steps (params) "Step through the range to make a number of clock tables." === modified file 'lisp/org/org-compat.el' --- lisp/org/org-compat.el 2014-06-23 15:32:24 +0000 +++ lisp/org/org-compat.el 2014-10-03 15:44:46 +0000 @@ -312,8 +312,7 @@ (defun org-in-invisibility-spec-p (arg) "Is ARG a member of `buffer-invisibility-spec'?" (if (consp buffer-invisibility-spec) - (member arg buffer-invisibility-spec) - nil)) + (member arg buffer-invisibility-spec))) (defmacro org-xemacs-without-invisibility (&rest body) "Turn off extents with invisibility while executing BODY." @@ -347,18 +346,8 @@ "Move to column COLUMN. Pass COLUMN and FORCE to `move-to-column'. Pass BUFFER to the XEmacs version of `move-to-column'." - (let* ((with-bracket-link - (save-excursion - (forward-line 0) - (looking-at (concat "^.*" org-bracket-link-regexp)))) - (buffer-invisibility-spec - (cond - ((or (not (derived-mode-p 'org-mode)) - (and with-bracket-link (org-invisible-p2))) - (remove '(org-link) buffer-invisibility-spec)) - (with-bracket-link - (remove t buffer-invisibility-spec)) - (t buffer-invisibility-spec)))) + (let ((buffer-invisibility-spec + (remove '(org-filtered) buffer-invisibility-spec))) (if (featurep 'xemacs) (org-xemacs-without-invisibility (move-to-column column force buffer)) === modified file 'lisp/org/org-element.el' --- lisp/org/org-element.el 2014-04-22 14:07:45 +0000 +++ lisp/org/org-element.el 2014-10-03 08:13:51 +0000 @@ -360,11 +360,6 @@ (footnote-reference . :inline-definition)) "Alist between element types and location of secondary value.") -(defconst org-element-object-variables '(org-link-abbrev-alist-local) - "List of buffer-local variables used when parsing objects. -These variables are copied to the temporary buffer created by -`org-export-secondary-string'.") - ;;; Accessors and Setters @@ -732,11 +727,11 @@ Return a list whose CAR is `headline' and CDR is a plist containing `:raw-value', `:title', `:alt-title', `:begin', -`:end', `:pre-blank', `:hiddenp', `:contents-begin' and +`:end', `:pre-blank', `:hiddenp', `:contents-begin', `:contents-end', `:level', `:priority', `:tags', `:todo-keyword',`:todo-type', `:scheduled', `:deadline', -`:closed', `:quotedp', `:archivedp', `:commentedp' and -`:footnote-section-p' keywords. +`:closed', `:quotedp', `:archivedp', `:commentedp', +`:footnote-section-p' and `:post-blank' keywords. The plist also contains any property set in the property drawer, with its name in upper cases and colons added at the @@ -875,38 +870,40 @@ (org-element-property :tags headline)) (org-element-property :tags headline)))) (and tag-list - (format ":%s:" (mapconcat 'identity tag-list ":"))))) + (format ":%s:" (mapconcat #'identity tag-list ":"))))) (commentedp (org-element-property :commentedp headline)) (quotedp (org-element-property :quotedp headline)) (pre-blank (or (org-element-property :pre-blank headline) 0)) - (heading (concat (make-string (org-reduced-level level) ?*) - (and todo (concat " " todo)) - (and quotedp (concat " " org-quote-string)) - (and commentedp (concat " " org-comment-string)) - (and priority - (format " [#%s]" (char-to-string priority))) - (cond ((and org-footnote-section - (org-element-property - :footnote-section-p headline)) - (concat " " org-footnote-section)) - (title (concat " " title)))))) - (concat heading - ;; Align tags. - (when tags - (cond - ((zerop org-tags-column) (format " %s" tags)) - ((< org-tags-column 0) - (concat - (make-string - (max (- (+ org-tags-column (length heading) (length tags))) 1) - ? ) - tags)) - (t - (concat - (make-string (max (- org-tags-column (length heading)) 1) ? ) - tags)))) - (make-string (1+ pre-blank) 10) - contents))) + (heading + (concat (make-string (if org-odd-levels-only (1- (* level 2)) level) + ?*) + (and todo (concat " " todo)) + (and quotedp (concat " " org-quote-string)) + (and commentedp (concat " " org-comment-string)) + (and priority (format " [#%s]" (char-to-string priority))) + " " + (if (and org-footnote-section + (org-element-property :footnote-section-p headline)) + org-footnote-section + title)))) + (concat + heading + ;; Align tags. + (when tags + (cond + ((zerop org-tags-column) (format " %s" tags)) + ((< org-tags-column 0) + (concat + (make-string + (max (- (+ org-tags-column (length heading) (length tags))) 1) + ?\s) + tags)) + (t + (concat + (make-string (max (- org-tags-column (length heading)) 1) ?\s) + tags)))) + (make-string (1+ pre-blank) ?\n) + contents))) ;;;; Inlinetask @@ -1315,36 +1312,36 @@ `:contents-end', `:post-blank' and `:post-affiliated' keywords. Assume point is at the beginning of the property drawer." - (save-excursion - (let ((case-fold-search t)) - (if (not (save-excursion - (re-search-forward "^[ \t]*:END:[ \t]*$" limit t))) - ;; Incomplete drawer: parse it as a paragraph. - (org-element-paragraph-parser limit affiliated) - (save-excursion - (let* ((drawer-end-line (match-beginning 0)) - (begin (car affiliated)) - (post-affiliated (point)) - (contents-begin (progn (forward-line) - (and (< (point) drawer-end-line) - (point)))) - (contents-end (and contents-begin drawer-end-line)) - (hidden (org-invisible-p2)) - (pos-before-blank (progn (goto-char drawer-end-line) - (forward-line) - (point))) - (end (progn (skip-chars-forward " \r\t\n" limit) - (if (eobp) (point) (line-beginning-position))))) - (list 'property-drawer - (nconc - (list :begin begin - :end end - :hiddenp hidden - :contents-begin contents-begin - :contents-end contents-end - :post-blank (count-lines pos-before-blank end) - :post-affiliated post-affiliated) - (cdr affiliated))))))))) + (let ((case-fold-search t)) + (if (not (save-excursion (re-search-forward "^[ \t]*:END:[ \t]*$" limit t))) + ;; Incomplete drawer: parse it as a paragraph. + (org-element-paragraph-parser limit affiliated) + (save-excursion + (let* ((drawer-end-line (match-beginning 0)) + (begin (car affiliated)) + (post-affiliated (point)) + (contents-begin + (progn + (forward-line) + (and (re-search-forward org-property-re drawer-end-line t) + (line-beginning-position)))) + (contents-end (and contents-begin drawer-end-line)) + (hidden (org-invisible-p2)) + (pos-before-blank (progn (goto-char drawer-end-line) + (forward-line) + (point))) + (end (progn (skip-chars-forward " \r\t\n" limit) + (if (eobp) (point) (line-beginning-position))))) + (list 'property-drawer + (nconc + (list :begin begin + :end end + :hiddenp hidden + :contents-begin contents-begin + :contents-end contents-end + :post-blank (count-lines pos-before-blank end) + :post-affiliated post-affiliated) + (cdr affiliated)))))))) (defun org-element-property-drawer-interpreter (property-drawer contents) "Interpret PROPERTY-DRAWER element as Org syntax. @@ -2099,28 +2096,28 @@ Return a list whose CAR is `node-property' and CDR is a plist containing `:key', `:value', `:begin', `:end' and `:post-blank' keywords." - (save-excursion - (looking-at org-property-re) - (let ((case-fold-search t) - (begin (point)) - (key (org-match-string-no-properties 2)) - (value (org-match-string-no-properties 3)) - (pos-before-blank (progn (forward-line) (point))) - (end (progn (skip-chars-forward " \r\t\n" limit) - (if (eobp) (point) (point-at-bol))))) - (list 'node-property - (list :key key - :value value - :begin begin - :end end - :post-blank (count-lines pos-before-blank end)))))) + (looking-at org-property-re) + (let ((begin (point)) + (key (org-match-string-no-properties 2)) + (value (org-match-string-no-properties 3)) + (end (save-excursion + (end-of-line) + (if (re-search-forward org-property-re limit t) + (line-beginning-position) + limit)))) + (list 'node-property + (list :key key + :value value + :begin begin + :end end + :post-blank 0)))) (defun org-element-node-property-interpreter (node-property contents) "Interpret NODE-PROPERTY element as Org syntax. CONTENTS is nil." (format org-property-format (format ":%s:" (org-element-property :key node-property)) - (org-element-property :value node-property))) + (or (org-element-property :value node-property) ""))) ;;;; Paragraph @@ -2486,7 +2483,7 @@ (defun org-element-table-interpreter (table contents) "Interpret TABLE element as Org syntax. -CONTENTS is nil." +CONTENTS is a string, if table's type is `org', or nil." (if (eq (org-element-property :type table) 'table.el) (org-remove-indentation (org-element-property :value table)) (concat (with-temp-buffer (insert contents) @@ -3112,16 +3109,20 @@ (cond ;; File type. ((or (file-name-absolute-p raw-link) - (string-match "^\\.\\.?/" raw-link)) + (string-match "\\`\\.\\.?/" raw-link)) (setq type "file" path raw-link)) ;; Explicit type (http, irc, bbdb...). See `org-link-types'. - ((string-match org-link-re-with-space3 raw-link) - (setq type (match-string 1 raw-link) path (match-string 2 raw-link))) + ((string-match org-link-types-re raw-link) + (setq type (match-string 1 raw-link) + ;; According to RFC 3986, extra whitespace should be + ;; ignored when a URI is extracted. + path (replace-regexp-in-string + "[ \t]*\n[ \t]*" "" (substring raw-link (match-end 0))))) ;; Id type: PATH is the id. - ((string-match "^id:\\([-a-f0-9]+\\)" raw-link) + ((string-match "\\`id:\\([-a-f0-9]+\\)" raw-link) (setq type "id" path (match-string 1 raw-link))) ;; Code-ref type: PATH is the name of the reference. - ((string-match "^(\\(.*\\))$" raw-link) + ((string-match "\\`(\\(.*\\))\\'" raw-link) (setq type "coderef" path (match-string 1 raw-link))) ;; Custom-id type: PATH is the name of the custom id. ((= (aref raw-link 0) ?#) @@ -3541,7 +3542,7 @@ `:month-end', `:day-end', `:hour-end', `:minute-end', `:repeater-type', `:repeater-value', `:repeater-unit', `:warning-type', `:warning-value', `:warning-unit', `:begin', -`:end', `:value' and `:post-blank' keywords. +`:end' and `:post-blank' keywords. Assume point is at the beginning of the timestamp." (save-excursion @@ -3890,8 +3891,7 @@ (goto-char (car affiliated)) (org-element-keyword-parser limit nil)) ;; LaTeX Environment. - ((looking-at - "[ \t]*\\\\begin{[A-Za-z0-9*]+}\\(\\[.*?\\]\\|{.*?}\\)*[ \t]*$") + ((looking-at "[ \t]*\\\\begin{\\([A-Za-z0-9]+\\*?\\)}\\(\\[.*?\\]\\|{.*?}\\)*[ \t]*$") (org-element-latex-environment-parser limit affiliated)) ;; Drawer and Property Drawer. ((looking-at org-drawer-regexp) @@ -4090,21 +4090,18 @@ Optional argument PARENT, when non-nil, is the element or object containing the secondary string. It is used to set correctly `:parent' property within the string." - ;; Copy buffer-local variables listed in - ;; `org-element-object-variables' into temporary buffer. This is - ;; required since object parsing is dependent on these variables. - (let ((pairs (delq nil (mapcar (lambda (var) - (when (boundp var) - (cons var (symbol-value var)))) - org-element-object-variables)))) + (let ((local-variables (buffer-local-variables))) (with-temp-buffer - (mapc (lambda (pair) (org-set-local (car pair) (cdr pair))) pairs) + (dolist (v local-variables) + (ignore-errors + (if (symbolp v) (makunbound v) + (org-set-local (car v) (cdr v))))) (insert string) + (restore-buffer-modified-p nil) (let ((secondary (org-element--parse-objects (point-min) (point-max) nil restriction))) (when parent - (mapc (lambda (obj) (org-element-put-property obj :parent parent)) - secondary)) + (dolist (o secondary) (org-element-put-property o :parent parent))) secondary)))) (defun org-element-map @@ -4617,29 +4614,29 @@ (let* ((min-ind most-positive-fixnum) find-min-ind ; For byte-compiler. (find-min-ind - (function - ;; Return minimal common indentation within BLOB. This is - ;; done by walking recursively BLOB and updating MIN-IND - ;; along the way. FIRST-FLAG is non-nil when the first - ;; string hasn't been seen yet. It is required as this - ;; string is the only one whose indentation doesn't happen - ;; after a newline character. - (lambda (blob first-flag) - (dolist (object (org-element-contents blob)) - (when (and first-flag (stringp object)) - (setq first-flag nil) - (string-match "\\`\\( *\\)" object) - (let ((len (length (match-string 1 object)))) - ;; An indentation of zero means no string will be - ;; modified. Quit the process. - (if (zerop len) (throw 'zero (setq min-ind 0)) - (setq min-ind (min len min-ind))))) - (cond - ((stringp object) - (dolist (line (delq "" (cdr (org-split-string object " *\n")))) - (setq min-ind (min (org-get-indentation line) min-ind)))) - ((memq (org-element-type object) org-element-recursive-objects) - (funcall find-min-ind object first-flag)))))))) + ;; Return minimal common indentation within BLOB. This is + ;; done by walking recursively BLOB and updating MIN-IND + ;; along the way. FIRST-FLAG is non-nil when the first + ;; string hasn't been seen yet. It is required as this + ;; string is the only one whose indentation doesn't happen + ;; after a newline character. + (lambda (blob first-flag) + (dolist (object (org-element-contents blob)) + (when (and first-flag (stringp object)) + (setq first-flag nil) + (string-match "\\` *" object) + (let ((len (match-end 0))) + ;; An indentation of zero means no string will be + ;; modified. Quit the process. + (if (zerop len) (throw 'zero (setq min-ind 0)) + (setq min-ind (min len min-ind))))) + (cond + ((stringp object) + (dolist (line (cdr (org-split-string object " *\n"))) + (unless (string= line "") + (setq min-ind (min (org-get-indentation line) min-ind))))) + ((memq (org-element-type object) org-element-recursive-objects) + (funcall find-min-ind object first-flag))))))) ;; Find minimal indentation in ELEMENT. (catch 'zero (funcall find-min-ind element (not ignore-first))) (if (or (zerop min-ind) (= min-ind most-positive-fixnum)) element === modified file 'lisp/org/org-entities.el' --- lisp/org/org-entities.el 2014-04-22 14:07:45 +0000 +++ lisp/org/org-entities.el 2014-10-03 08:13:51 +0000 @@ -27,9 +27,8 @@ ;;; Code: -(require 'org-macs) - -(declare-function org-table-align "org-table" ()) +(declare-function org-toggle-pretty-entities "org" ()) +(declare-function org-table-align "org-table" ()) (eval-when-compile (require 'cl)) @@ -568,6 +567,7 @@ (goto-char pos) (org-table-align))) +(defvar org-pretty-entities) ;; declare defcustom from org (defun org-entities-help () "Create a Help buffer with all available entities." (interactive) === modified file 'lisp/org/org-habit.el' --- lisp/org/org-habit.el 2014-01-07 13:22:53 +0000 +++ lisp/org/org-habit.el 2014-10-03 08:13:51 +0000 @@ -351,14 +351,7 @@ (let ((inhibit-read-only t) l c (buffer-invisibility-spec '(org-link)) (moment (time-subtract (current-time) - (list 0 (* 3600 org-extend-today-until) 0))) - disabled-overlays) - ;; Disable filters; this helps with alignment if there are links. - (mapc (lambda (ol) - (when (overlay-get ol 'invisible) - (overlay-put ol 'invisible nil) - (setq disabled-overlays (cons ol disabled-overlays)))) - (overlays-in (point-min) (point-max))) + (list 0 (* 3600 org-extend-today-until) 0)))) (save-excursion (goto-char (if line (point-at-bol) (point-min))) (while (not (eobp)) @@ -374,9 +367,7 @@ (time-subtract moment (days-to-time org-habit-preceding-days)) moment (time-add moment (days-to-time org-habit-following-days)))))) - (forward-line))) - (mapc (lambda (ol) (overlay-put ol 'invisible t)) - disabled-overlays))) + (forward-line))))) (defun org-habit-toggle-habits () "Toggle display of habits in an agenda buffer." === modified file 'lisp/org/org-list.el' --- lisp/org/org-list.el 2014-06-22 23:12:17 +0000 +++ lisp/org/org-list.el 2014-10-03 15:44:46 +0000 @@ -2237,7 +2237,7 @@ t))))) (defun org-list-repair () - "Fix indentation, bullets and checkboxes is the list at point." + "Fix indentation, bullets and checkboxes in the list at point." (interactive) (unless (org-at-item-p) (error "This is not a list")) (let* ((struct (org-list-struct)) === modified file 'lisp/org/org-macs.el' --- lisp/org/org-macs.el 2014-01-01 07:43:34 +0000 +++ lisp/org/org-macs.el 2014-10-03 08:13:51 +0000 @@ -154,9 +154,9 @@ `(let ((,mpom ,pom)) (save-excursion (if (markerp ,mpom) (set-buffer (marker-buffer ,mpom))) - (save-excursion - (goto-char (or ,mpom (point))) - ,@body))))) + (org-with-wide-buffer + (goto-char (or ,mpom (point))) + ,@body))))) (def-edebug-spec org-with-point-at (form body)) (put 'org-with-point-at 'lisp-indent-function 1) === modified file 'lisp/org/org-mobile.el' --- lisp/org/org-mobile.el 2014-04-22 14:07:45 +0000 +++ lisp/org/org-mobile.el 2014-10-03 08:13:51 +0000 @@ -1074,7 +1074,7 @@ ;; which prevents correct insertion when point is invisible (org-show-subtree) (end-of-line 1) - (org-insert-heading-respect-content '(16) t) + (org-insert-heading-respect-content t) (org-demote)) (beginning-of-line) (insert "* ")) === modified file 'lisp/org/org-mouse.el' --- lisp/org/org-mouse.el 2014-06-22 05:43:58 +0000 +++ lisp/org/org-mouse.el 2014-10-03 15:44:46 +0000 @@ -953,20 +953,23 @@ (point) (save-excursion (goto-char start) (org-back-to-heading) (point)))) - (outline-end-of-subtree) + (progn (org-end-of-subtree nil t) + (unless (eobp) (backward-char))) (end-of-line) (if (eobp) (newline) (forward-char))) (when (looking-at org-outline-regexp) (let ((level (- (match-end 0) (match-beginning 0)))) (when (> end (match-end 0)) - (outline-end-of-subtree) + (progn (org-end-of-subtree nil t) + (unless (eobp) (backward-char))) (end-of-line) (if (eobp) (newline) (forward-char)) (setq level (1+ level))) (org-paste-subtree level) (save-excursion - (outline-end-of-subtree) + (progn (org-end-of-subtree nil t) + (unless (eobp) (backward-char))) (when (bolp) (delete-char -1)))))))))) @@ -1003,8 +1006,8 @@ (org-mouse-main-buffer (current-buffer))) (when (eq (with-current-buffer buffer major-mode) 'org-mode) (let ((endmarker (with-current-buffer buffer - (outline-end-of-subtree) - (forward-char 1) + (org-end-of-subtree nil t) + (unless (eobp) (forward-char 1)) (point-marker)))) (org-with-remote-undo buffer (with-current-buffer buffer === modified file 'lisp/org/org-src.el' --- lisp/org/org-src.el 2014-05-29 03:45:29 +0000 +++ lisp/org/org-src.el 2014-10-03 15:44:46 +0000 @@ -376,23 +376,21 @@ (when (fboundp edit-prep-func) (funcall edit-prep-func full-info))) (or org-edit-src-code-timer + (zerop org-edit-src-auto-save-idle-delay) (setq org-edit-src-code-timer - (unless (zerop org-edit-src-auto-save-idle-delay) - (run-with-idle-timer - org-edit-src-auto-save-idle-delay t - (lambda () - (cond - ((and (string-match "\*Org Src" (buffer-name)) - (buffer-modified-p)) - (org-edit-src-save)) - ((not - (delq nil (mapcar - (lambda (b) - (string-match "\*Org Src" (buffer-name b))) - (buffer-list)))) - (cancel-timer org-edit-src-code-timer) - (setq org-edit-src-code-timer))))))))) - t))) + (run-with-idle-timer + org-edit-src-auto-save-idle-delay t + (lambda () + (cond + ((org-string-match-p "\\`\\*Org Src" (buffer-name)) + (when (buffer-modified-p) (org-edit-src-save))) + ((not (org-some (lambda (b) + (org-string-match-p "\\`\\*Org Src" + (buffer-name b))) + (buffer-list))) + (cancel-timer org-edit-src-code-timer) + (setq org-edit-src-code-timer nil)))))))) + t))) (defun org-edit-src-continue (e) "Continue editing source blocks." ;; Fixme: be more accurate @@ -757,8 +755,8 @@ (delete-region beg (max beg end)) (unless (string-match "\\`[ \t]*\\'" code) (insert code)) - ;; Make sure the overlay stays in place - (when (eq context 'save) (move-overlay ovl beg (point))) + ;; Make sure the overlay stays in place + (when (eq context 'save) (move-overlay ovl beg (point))) (goto-char beg) (if single (just-one-space))) (if (memq t (mapcar (lambda (overlay) @@ -774,9 +772,6 @@ (unless (eq context 'save) (move-marker beg nil) (move-marker end nil))) - (when org-edit-src-code-timer - (cancel-timer org-edit-src-code-timer) - (setq org-edit-src-code-timer nil)) (unless (eq context 'save) (when org-edit-src-saved-temp-window-config (set-window-configuration org-edit-src-saved-temp-window-config) === modified file 'lisp/org/org-table.el' --- lisp/org/org-table.el 2014-06-22 05:43:58 +0000 +++ lisp/org/org-table.el 2014-10-03 15:44:46 +0000 @@ -2712,7 +2712,8 @@ (or (fboundp 'calc-eval) (user-error "Calc does not seem to be installed, and is needed to evaluate the formula")) ;; Use <...> time-stamps so that Calc can handle them - (setq form (replace-regexp-in-string org-ts-regexp3 "<\\1>" form)) + (while (string-match (concat "\\[" org-ts-regexp1 "\\]") form) + (setq form (replace-match "<\\1>" nil nil form))) ;; I18n-ize local time-stamps by setting (system-time-locale "C") (when (string-match org-ts-regexp2 form) (let* ((ts (match-string 0 form)) @@ -3862,9 +3863,10 @@ (push org-table-current-begin-pos org-show-positions) (let ((min (apply 'min org-show-positions)) (max (apply 'max org-show-positions))) - (goto-char min) (recenter 0) + (set-window-start (selected-window) min) (goto-char max) - (or (pos-visible-in-window-p max) (recenter -1)))) + (or (pos-visible-in-window-p max) + (set-window-start (selected-window) max)))) (select-window win)))) (defun org-table-force-dataline () === modified file 'lisp/org/org-timer.el' --- lisp/org/org-timer.el 2014-04-22 14:07:45 +0000 +++ lisp/org/org-timer.el 2014-10-03 08:13:51 +0000 @@ -186,7 +186,10 @@ (insert (org-timer-value-string)))) (defun org-timer-value-string () - (format org-timer-format (org-timer-secs-to-hms (floor (org-timer-seconds))))) + "Set the timer string." + (format org-timer-format + (org-timer-secs-to-hms + (abs (floor (org-timer-seconds)))))) (defvar org-timer-timer-is-countdown nil) (defun org-timer-seconds () === modified file 'lisp/org/org-version.el' --- lisp/org/org-version.el 2014-04-22 14:07:45 +0000 +++ lisp/org/org-version.el 2014-10-03 08:13:51 +0000 @@ -5,13 +5,13 @@ (defun org-release () "The release version of org-mode. Inserted by installing org-mode or when a release is made." - (let ((org-release "8.2.6")) + (let ((org-release "8.2.8")) org-release)) ;;;###autoload (defun org-git-version () "The Git version of org-mode. Inserted by installing org-mode or when a release is made." - (let ((org-git-version "release_8.2.6-1")) + (let ((org-git-version "release_8.2.8")) org-git-version)) (provide 'org-version) === modified file 'lisp/org/org.el' --- lisp/org/org.el 2014-05-29 03:45:29 +0000 +++ lisp/org/org.el 2014-10-03 15:44:46 +0000 @@ -111,6 +111,8 @@ (unless (boundp 'diary-fancy-buffer) (org-defvaralias 'diary-fancy-buffer 'fancy-diary-buffer)) +(declare-function org-add-archive-files "org-archive" (files)) + (declare-function org-inlinetask-at-task-p "org-inlinetask" ()) (declare-function org-inlinetask-outline-regexp "org-inlinetask" ()) (declare-function org-inlinetask-toggle-visibility "org-inlinetask" ()) @@ -118,7 +120,10 @@ (declare-function org-clock-get-last-clock-out-time "org-clock" ()) (declare-function org-clock-timestamps-up "org-clock" (&optional n)) (declare-function org-clock-timestamps-down "org-clock" (&optional n)) +(declare-function org-clock-remove-overlays "org-clock" (&optional beg end noremove)) (declare-function org-clock-sum-current-item "org-clock" (&optional tstart)) +(declare-function org-clock-update-time-maybe "org-clock" ()) +(declare-function org-clocktable-shift "org-clock" (dir n)) (declare-function orgtbl-mode "org-table" (&optional arg)) (declare-function org-clock-out "org-clock" (&optional switch-to-state fail-quietly at-time)) @@ -133,6 +138,10 @@ (declare-function org-agenda-list "org-agenda" (&optional arg start-day span)) (declare-function org-agenda-redo "org-agenda" (&optional all)) (declare-function org-table-align "org-table" ()) +(declare-function org-table-begin "org-table" (&optional table-type)) +(declare-function org-table-blank-field "org-table" ()) +(declare-function org-table-end "org-table" (&optional table-type)) +(declare-function org-table-insert-row "org-table" (&optional arg)) (declare-function org-table-paste-rectangle "org-table" ()) (declare-function org-table-maybe-eval-formula "org-table" ()) (declare-function org-table-maybe-recalculate-line "org-table" ()) @@ -179,6 +188,7 @@ (intern (concat "org-babel-expand-body:" lang))))))) org-babel-load-languages)) +(declare-function org-babel-tangle-file "ob-tangle" (file &optional target-file lang)) ;;;###autoload (defun org-babel-load-file (file &optional compile) "Load Emacs Lisp source code blocks in the Org-mode FILE. @@ -5109,9 +5119,9 @@ "\\(?: +\\(\\[#.\\]\\)\\)?" "\\(?: +" ;; Stats cookies can be stuck to body. - "\\(?:\\[[0-9%%/]+\\] *\\)?" + "\\(?:\\[[0-9%%/]+\\] *\\)*" "\\(%s\\)" - "\\(?: *\\[[0-9%%/]+\\]\\)?" + "\\(?: *\\[[0-9%%/]+\\]\\)*" "\\)" (org-re "\\(?:[ \t]+\\(:[[:alnum:]_@#%%:]+:\\)\\)?") "[ \t]*$") @@ -5417,8 +5427,7 @@ (org-add-hook 'isearch-mode-end-hook 'org-isearch-end 'append 'local) ;; Emacs 22 deals with this through a special variable (org-set-local 'outline-isearch-open-invisible-function - (lambda (&rest ignore) (org-show-context 'isearch))) - (org-add-hook 'isearch-mode-end-hook 'org-fix-ellipsis-at-bol 'append 'local)) + (lambda (&rest ignore) (org-show-context 'isearch)))) ;; Setup the pcomplete hooks (set (make-local-variable 'pcomplete-command-completion-function) @@ -5473,9 +5482,6 @@ (put 'org-mode 'flyspell-mode-predicate 'org-mode-flyspell-verify) -(defsubst org-fix-ellipsis-at-bol () - (save-excursion (goto-char (window-start)) (recenter 0))) - (defun org-find-invisible-foreground () (let ((candidates (remove "unspecified-bg" @@ -5881,7 +5887,7 @@ ((member dc1 '("+title:" "+author:" "+email:" "+date:")) (add-text-properties beg (match-end 3) - (if (member (intern (substring dc1 0 -1)) org-hidden-keywords) + (if (member (intern (substring dc1 1 -1)) org-hidden-keywords) '(font-lock-fontified t invisible t) '(font-lock-fontified t face org-document-info-keyword))) (add-text-properties @@ -6145,15 +6151,25 @@ (defvar org-font-lock-keywords nil) -(defsubst org-re-property (property &optional literal) +(defsubst org-re-property (property &optional literal allow-null) "Return a regexp matching a PROPERTY line. -Match group 3 will be set to the value if it exists." - (concat "^\\(?4:[ \t]*\\)\\(?1::\\(?2:" - (if literal property (regexp-quote property)) - "\\):\\)[ \t]+\\(?3:[^ \t\r\n].*?\\)\\(?5:[ \t]*\\)$")) + +When optional argument LITERAL is non-nil, do not quote PROPERTY. +This is useful when PROPERTY is a regexp. When ALLOW-NULL is +non-nil, match properties even without a value. + +Match group 3 is set to the value when it exists. If there is no +value and ALLOW-NULL is non-nil, it is set to the empty string." + (concat + "^\\(?4:[ \t]*\\)" + (format "\\(?1::\\(?2:%s\\):\\)" + (if literal property (regexp-quote property))) + (if allow-null + "\\(?:\\(?3:$\\)\\|[ \t]+\\(?3:.*?\\)\\)\\(?5:[ \t]*\\)$" + "[ \t]+\\(?3:[^ \r\t\n]+.*?\\)\\(?5:[ \t]*\\)$"))) (defconst org-property-re - (org-re-property ".*?" 'literal) + (org-re-property ".*?" 'literal t) "Regular expression matching a property line. There are four matching groups: 1: :PROPKEY: including the leading and trailing colon, @@ -6712,7 +6728,8 @@ (setq org-cycle-global-status 'overview) (run-hook-with-args 'org-cycle-hook 'overview))))) -(defvar org-called-with-limited-levels);Dyn-bound in ̀org-with-limited-levels'. +(defvar org-called-with-limited-levels nil + "Non-nil when `org-with-limited-levels' is currently active.") (defun org-cycle-internal-local () "Do the local cycling action." @@ -6729,7 +6746,8 @@ (setq has-children (org-list-has-child-p (point) struct))) (org-back-to-heading) (setq eoh (save-excursion (outline-end-of-heading) (point))) - (setq eos (save-excursion (1- (org-end-of-subtree t t)))) + (setq eos (save-excursion (org-end-of-subtree t t) + (when (bolp) (backward-char)) (point))) (setq has-children (or (save-excursion (let ((level (funcall outline-level))) @@ -6894,21 +6912,20 @@ ;; buffers, where outline-regexp is needed. (defun org-overview () "Switch to overview mode, showing only top-level headlines. -Really, this shows all headlines with level equal or greater than the level +This shows all headlines with a level equal or greater than the level of the first headline in the buffer. This is important, because if the first headline is not level one, then (hide-sublevels 1) gives confusing results." (interactive) - (let ((pos (point)) - (level (save-excursion - (goto-char (point-min)) - (if (re-search-forward (concat "^" outline-regexp) nil t) - (progn - (goto-char (match-beginning 0)) - (funcall outline-level)))))) - (and level (hide-sublevels level)) - (recenter '(4)) - (goto-char pos))) + (save-excursion + (let ((level + (save-excursion + (goto-char (point-min)) + (if (re-search-forward (concat "^" outline-regexp) nil t) + (progn + (goto-char (match-beginning 0)) + (funcall outline-level)))))) + (and level (hide-sublevels level))))) (defun org-content (&optional arg) "Show all headlines in the buffer, like a table of contents. @@ -7105,13 +7122,11 @@ (pos-visible-in-window-p (save-excursion (org-end-of-subtree t) (point)))) -(defun org-first-headline-recenter (&optional N) - "Move cursor to the first headline and recenter the headline. -Optional argument N means put the headline into the Nth line of the window." +(defun org-first-headline-recenter () + "Move cursor to the first headline and recenter the headline." (goto-char (point-min)) (when (re-search-forward (concat "^\\(" org-outline-regexp "\\)") nil t) - (beginning-of-line) - (recenter (prefix-numeric-value N)))) + (set-window-start (selected-window) (point-at-bol)))) ;;; Saving and restoring visibility @@ -7545,23 +7560,22 @@ (looking-at "[ \t]*$"))))) (defun org-insert-heading (&optional arg invisible-ok) - "Insert a new heading or item with same depth at point. + "Insert a new heading or an item with the same depth at point. If point is at the beginning of a heading or a list item, insert -a heading or a list item before it. - -If point is at the beginning of a normal line, turn this line -into a heading. +a new heading or a new item above the current one. If point is +at the beginning of a normal line, turn the line into a heading. If point is in the middle of a headline or a list item, split the headline or the item and create a new headline/item with the text in the current line after point \(see `org-M-RET-may-split-line' on how to modify this behavior). -With one universal prefix argument: If point is within a list, -insert a heading instead of a list item. Otherwise, set the -value of `org-insert-heading-respect-content' to `t' for the -duration of the command. +With one universal prefirx argument, set the user option +`org-insert-heading-respect-content' to t for the duration of +the command. This modifies the behavior described above in this +ways: on list items and at the beginning of normal lines, force +the insertion of a heading after the current subtree. With two universal prefix arguments, insert the heading at the end of the grandparent subtree. For example, if point is within @@ -7589,12 +7603,19 @@ (or arg (not itemp)))) ;; At beginning of buffer or so high up that only a heading ;; makes sense. - (insert - (if (or (bobp) (org-previous-line-empty-p)) "" "\n") - (if (org-in-src-block-p) ",* " "* ")) + (cond ((and (bolp) (not respect-content)) (insert "* ")) + ((not respect-content) + (unless may-split (end-of-line)) + (insert "\n* ")) + ((re-search-forward org-outline-regexp-bol nil t) + (beginning-of-line) + (insert "* \n") + (backward-char)) + (t (goto-char (point-max)) + (insert "\n* "))) (run-hooks 'org-insert-heading-hook)) - ((and itemp (not (equal arg '(4)))) + ((and itemp (not (member arg '((4) (16))))) ;; Insert an item (org-insert-item)) @@ -7614,11 +7635,12 @@ nil)) ;; Get a level string to fall back on (fix-level - (save-excursion - (org-back-to-heading t) - (if (org-previous-line-empty-p) (setq empty-line-p t)) - (looking-at org-outline-regexp) - (make-string (1- (length (match-string 0))) ?*))) + (if (org-before-first-heading-p) "*" + (save-excursion + (org-back-to-heading t) + (if (org-previous-line-empty-p) (setq empty-line-p t)) + (looking-at org-outline-regexp) + (make-string (1- (length (match-string 0))) ?*)))) (stars (save-excursion (condition-case nil @@ -7650,8 +7672,12 @@ pos hide-previous previous-pos) ;; If we insert after content, move there and clean up whitespace - (when (and respect-content (not (org-on-heading-p))) - (org-end-of-subtree nil t) + (when (and respect-content + (not (org-looking-at-p org-outline-regexp-bol))) + (if (not (org-before-first-heading-p)) + (org-end-of-subtree nil t) + (re-search-forward org-outline-regexp-bol) + (beginning-of-line 0)) (skip-chars-backward " \r\n") (and (not (looking-back "^\*+")) (looking-at "[ \t]+") (replace-match "")) @@ -7680,10 +7706,9 @@ (setq initial-content (org-trim initial-content))) (goto-char pos)) ;; a normal line - (unless (bolp) - (setq initial-content (buffer-substring (point) (point-at-eol))) - (delete-region (point) (point-at-eol)) - (setq initial-content (org-trim initial-content))))) + (setq initial-content + (org-trim (buffer-substring (point) (point-at-eol)))) + (delete-region (point) (point-at-eol)))) ;; If we are at the beginning of the line, insert before it. Else after (cond @@ -7708,13 +7733,12 @@ "Make the number of empty lines before current exactly N. So this will delete or add empty lines." (save-excursion - (goto-char (point-at-bol)) - (if (looking-back "\\s-+" nil 'greedy) - (replace-match "")) - (or (bobp) (insert "\n")) - (while (> N 0) - (insert "\n") - (setq N (1- N))))) + (beginning-of-line) + (let ((p (point))) + (skip-chars-backward " \r\t\n") + (unless (bolp) (forward-line)) + (delete-region (point) p)) + (when (> N 0) (insert (make-string N ?\n))))) (defun org-get-heading (&optional no-tags no-todo) "Return the heading of the current entry, without the stars. @@ -7783,17 +7807,15 @@ (org-move-subtree-down) (end-of-line 1)) -(defun org-insert-heading-respect-content (&optional arg invisible-ok) +(defun org-insert-heading-respect-content (&optional invisible-ok) "Insert heading with `org-insert-heading-respect-content' set to t." - (interactive "P") - (let ((org-insert-heading-respect-content t)) - (org-insert-heading '(4) invisible-ok))) + (interactive) + (org-insert-heading '(4) invisible-ok)) (defun org-insert-todo-heading-respect-content (&optional force-state) "Insert TODO heading with `org-insert-heading-respect-content' set to t." - (interactive "P") - (let ((org-insert-heading-respect-content t)) - (org-insert-todo-heading force-state '(4)))) + (interactive) + (org-insert-todo-heading force-state '(4))) (defun org-insert-todo-heading (arg &optional force-heading) "Insert a new heading with the same level and TODO state as current heading. @@ -8150,7 +8172,8 @@ (save-match-data (save-excursion (outline-end-of-heading) (setq folded (outline-invisible-p))) - (outline-end-of-subtree)) + (progn (org-end-of-subtree nil t) + (unless (eobp) (backward-char)))) (outline-next-heading) (setq ne-end (org-back-over-empty-lines)) (setq end (point)) @@ -8303,7 +8326,7 @@ (string-match "^\\*+$" (buffer-substring (point-at-bol) (point)))) - (- (match-end 1) (match-beginning 1))) + (- (match-end 0) (match-beginning 0))) ((and (bolp) (looking-at org-outline-regexp)) (- (match-end 0) (point) 1)))) @@ -10592,6 +10615,10 @@ (move-marker org-open-link-marker nil) (run-hook-with-args 'org-follow-link-hook))) +(defsubst org-uniquify (list) + "Non-destructively remove duplicate elements from LIST." + (let ((res (copy-sequence list))) (delete-dups res))) + (defun org-offer-links-in-entry (buffer marker &optional nth zero) "Offer links in the current entry and return the selected link. If there is only one link, return it. @@ -13640,8 +13667,7 @@ (error nil)) (not (bobp))) (org-flag-heading nil) - (when siblings-p (org-show-siblings))))) - (unless (eq key 'agenda) (org-fix-ellipsis-at-bol)))) + (when siblings-p (org-show-siblings))))))) (defvar org-reveal-start-hook nil "Hook run before revealing a location.") @@ -13836,7 +13862,7 @@ as N.") (defun org-scan-tags (action matcher todo-only &optional start-level) - "Sca headline tags with inheritance and produce output ACTION. + "Scan headline tags with inheritance and produce output ACTION. ACTION can be `sparse-tree' to produce a sparse tree in the current buffer, or `agenda' to produce an entry list for an agenda view. It can also be @@ -14744,8 +14770,8 @@ (if expert (set-buffer (get-buffer-create " *Org tags*")) (delete-other-windows) - (split-window-vertically) - (org-switch-to-buffer-other-window (get-buffer-create " *Org tags*"))) + (set-window-buffer (split-window-vertically) (get-buffer-create " *Org tags*")) + (org-switch-to-buffer-other-window " *Org tags*")) (erase-buffer) (org-set-local 'org-done-keywords done-keywords) (org-fast-tag-insert "Inherited" inherited i-face "\n") @@ -15269,7 +15295,10 @@ '("SCHEDULED" "DEADLINE" "CLOCK" "CLOSED" "TIMESTAMP" "TIMESTAMP_IA"))) (catch 'match - (while (re-search-forward org-maybe-keyword-time-regexp end t) + (while (and (re-search-forward org-maybe-keyword-time-regexp end t) + (not (text-property-any 0 (length (match-string 0)) + 'face 'font-lock-comment-face + (match-string 0)))) (setq key (if (match-end 1) (substring (org-match-string-no-properties 1) 0 -1)) @@ -15397,7 +15426,7 @@ (if (and range (goto-char (car range)) (re-search-forward - (org-re-property property) + (org-re-property property nil t) (cdr range) t)) (progn (delete-region (match-beginning 0) (1+ (point-at-eol))) @@ -15562,7 +15591,7 @@ (setq range (org-get-property-block beg end 'force)) (goto-char (car range)) (if (re-search-forward - (org-re-property property) (cdr range) t) + (org-re-property property nil t) (cdr range) t) (progn (delete-region (match-beginning 0) (match-end 0)) (goto-char (match-beginning 0))) @@ -15773,9 +15802,7 @@ (funcall set-function prompt (mapcar 'list (org-property-values property)) nil nil "" nil cur))))) - (if (equal val "") - cur - val))) + (org-trim val))) (defvar org-last-set-property nil) (defvar org-last-set-property-value nil) @@ -15853,8 +15880,10 @@ (org-icompleting-read "Property: " props nil t) (caar props)))) (list prop))) - (if (org-entry-delete nil property delete-empty-drawer) - (message "Property %s deleted" property))) + (if (not property) + (message "No property to delete in this entry") + (org-entry-delete nil property delete-empty-drawer) + (message "Property \"%s\" deleted" property))) (defun org-delete-property-globally (property) "Remove PROPERTY globally, from all entries." @@ -17743,9 +17772,9 @@ (defcustom org-agenda-inhibit-startup nil "Inhibit startup when preparing agenda buffers. -When this variable is `t' (the default), the initialization of -the Org agenda buffers is inhibited: e.g. the visibility state -is not set, the tables are not re-aligned, etc." +When this variable is `t', the initialization of the Org agenda +buffers is inhibited: e.g. the visibility state is not set, the +tables are not re-aligned, etc." :type 'boolean :version "24.3" :group 'org-agenda) @@ -21819,9 +21848,7 @@ "Return the reverse of STRING." (apply 'string (reverse (string-to-list string)))) -(defsubst org-uniquify (list) - "Non-destructively remove duplicate elements from LIST." - (let ((res (copy-sequence list))) (delete-dups res))) +;; defsubst org-uniquify must be defined before first use (defun org-uniquify-alist (alist) "Merge elements of ALIST with the same key. @@ -23273,14 +23300,6 @@ (forward-char -1)))))) (point)) -(defadvice outline-end-of-subtree (around prefer-org-version activate compile) - "Use Org version in org-mode, for dramatic speed-up." - (if (derived-mode-p 'org-mode) - (progn - (org-end-of-subtree nil t) - (unless (eobp) (backward-char 1))) - ad-do-it)) - (defun org-end-of-meta-data-and-drawers () "Jump to the first text after meta data and drawers in the current entry. This will move over empty lines, lines with planning time stamps, @@ -23777,8 +23796,7 @@ isearch-mode-end-hook-quit) ;; Only when the isearch was not quitted. (org-add-hook 'post-command-hook 'org-isearch-post-command - 'append 'local))) - (org-fix-ellipsis-at-bol))) + 'append 'local))))) (defun org-isearch-post-command () "Remove self from hook, and show context." === modified file 'lisp/org/ox-ascii.el' --- lisp/org/ox-ascii.el 2014-04-22 14:07:45 +0000 +++ lisp/org/ox-ascii.el 2014-10-03 08:13:51 +0000 @@ -192,8 +192,10 @@ (defcustom org-ascii-indented-line-width 'auto "Additional indentation width for the first line in a paragraph. If the value is an integer, indent the first line of each -paragraph by this number. If it is the symbol `auto' preserve -indentation from original document." +paragraph by this width, unless it is located at the beginning of +a section, in which case indentation is removed from that line. +If it is the symbol `auto' preserve indentation from original +document." :group 'org-export-ascii :version "24.4" :package-version '(Org . "8.0") @@ -421,17 +423,17 @@ string, see `org-ascii--justify-string'. Return nil if S isn't a string." - ;; Don't fill paragraph when break should be preserved. - (cond ((not (stringp s)) nil) - ((plist-get info :preserve-breaks) s) - (t (let ((double-space-p sentence-end-double-space)) - (with-temp-buffer - (let ((fill-column text-width) - (use-hard-newlines t) - (sentence-end-double-space double-space-p)) - (insert s) - (fill-region (point-min) (point-max) justify)) - (buffer-string)))))) + (when (stringp s) + (let ((double-space-p sentence-end-double-space)) + (with-temp-buffer + (let ((fill-column text-width) + (use-hard-newlines t) + (sentence-end-double-space double-space-p)) + (insert (if (plist-get info :preserve-breaks) + (replace-regexp-in-string "\n" hard-newline s) + s)) + (fill-region (point-min) (point-max) justify)) + (buffer-string))))) (defun org-ascii--justify-string (s text-width how) "Justify string S. @@ -455,13 +457,13 @@ Empty lines are not indented." (when (stringp s) (replace-regexp-in-string - "\\(^\\)\\(?:.*\\S-\\)" (make-string width ? ) s nil nil 1))) + "\\(^\\)[ \t]*\\S-" (make-string width ?\s) s nil nil 1))) (defun org-ascii--box-string (s info) "Return string S with a partial box to its left. INFO is a plist used as a communication channel." (let ((utf8p (eq (plist-get info :ascii-charset) 'utf-8))) - (format (if utf8p "╭────\n%s\n╰────" ",----\n%s\n`----") + (format (if utf8p "┌────\n%s\n└────" ",----\n%s\n`----") (replace-regexp-in-string "^" (if utf8p "│ " "| ") ;; Remove last newline character. @@ -473,7 +475,7 @@ (case (org-element-type element) ;; Elements with an absolute width: `headline' and `inlinetask'. (inlinetask org-ascii-inlinetask-width) - ('headline + (headline (- org-ascii-text-width (let ((low-level-rank (org-export-low-level-p element info))) (if low-level-rank (* low-level-rank 2) org-ascii-global-margin)))) @@ -1418,12 +1420,16 @@ "Transcode a PARAGRAPH element from Org to ASCII. CONTENTS is the contents of the paragraph, as a string. INFO is the plist used as a communication channel." - (let ((contents (if (not (wholenump org-ascii-indented-line-width)) contents - (concat - (make-string org-ascii-indented-line-width ? ) - (replace-regexp-in-string "\\`[ \t]+" "" contents))))) - (org-ascii--fill-string - contents (org-ascii--current-text-width paragraph info) info))) + (org-ascii--fill-string + (if (not (wholenump org-ascii-indented-line-width)) contents + (concat + ;; Do not indent first paragraph in a section. + (unless (and (not (org-export-get-previous-element paragraph info)) + (eq (org-element-type (org-export-get-parent paragraph)) + 'section)) + (make-string org-ascii-indented-line-width ?\s)) + (replace-regexp-in-string "\\`[ \t]+" "" contents))) + (org-ascii--current-text-width paragraph info) info)) ;;;; Plain List @@ -1591,8 +1597,8 @@ CONTENTS is the contents of the object. INFO is a plist holding contextual information." (if (org-element-property :use-brackets-p superscript) - (format "_{%s}" contents) - (format "_%s" contents))) + (format "^{%s}" contents) + (format "^%s" contents))) ;;;; Strike-through @@ -1659,20 +1665,25 @@ (or (gethash key cache) (puthash key - (or (and (not org-ascii-table-widen-columns) - (org-export-table-cell-width table-cell info)) - (let* ((max-width 0)) - (org-element-map table 'table-row - (lambda (row) - (setq max-width - (max (string-width - (org-export-data - (org-element-contents - (elt (org-element-contents row) col)) - info)) - max-width))) - info) - max-width)) + (let ((cookie-width (org-export-table-cell-width table-cell info))) + (or (and (not org-ascii-table-widen-columns) cookie-width) + (let ((contents-width + (let ((max-width 0)) + (org-element-map table 'table-row + (lambda (row) + (setq max-width + (max (string-width + (org-export-data + (org-element-contents + (elt (org-element-contents row) col)) + info)) + max-width))) + info) + max-width))) + (cond ((not cookie-width) contents-width) + (org-ascii-table-widen-columns + (max cookie-width contents-width)) + (t cookie-width))))) cache)))) (defun org-ascii-table-cell (table-cell contents info) === modified file 'lisp/org/ox-beamer.el' --- lisp/org/ox-beamer.el 2014-04-22 14:07:45 +0000 +++ lisp/org/ox-beamer.el 2014-10-03 08:13:51 +0000 @@ -687,7 +687,7 @@ (cond ((equal type "radio") (let ((destination (org-export-resolve-radio-link link info))) - (when destination + (if (not destination) contents (format "\\hyperlink%s{%s}{%s}" (or (org-beamer--element-has-overlay-p link) "") (org-export-solidify-link-text @@ -1092,6 +1092,7 @@ envs) '((:endgroup)) '(("BMCOL" . ?|)))) + (org-tag-persistent-alist nil) (org-use-fast-tag-selection t) (org-fast-tag-selection-single-key t)) (org-set-tags) === modified file 'lisp/org/ox-html.el' --- lisp/org/ox-html.el 2014-05-29 03:45:29 +0000 +++ lisp/org/ox-html.el 2014-10-03 15:44:46 +0000 @@ -2275,83 +2275,70 @@ "Transcode a HEADLINE element from Org to HTML. CONTENTS holds the contents of the headline. INFO is a plist holding contextual information." - ;; Empty contents? - (setq contents (or contents "")) - (let* ((numberedp (org-export-numbered-headline-p headline info)) - (level (org-export-get-relative-level headline info)) - (text (org-export-data (org-element-property :title headline) info)) - (todo (and (plist-get info :with-todo-keywords) - (let ((todo (org-element-property :todo-keyword headline))) - (and todo (org-export-data todo info))))) - (todo-type (and todo (org-element-property :todo-type headline))) - (tags (and (plist-get info :with-tags) - (org-export-get-tags headline info))) - (priority (and (plist-get info :with-priority) - (org-element-property :priority headline))) - (section-number (and (org-export-numbered-headline-p headline info) - (mapconcat 'number-to-string - (org-export-get-headline-number - headline info) "."))) - ;; Create the headline text. - (full-text (org-html-format-headline--wrap headline info))) - (cond - ;; Case 1: This is a footnote section: ignore it. - ((org-element-property :footnote-section-p headline) nil) - ;; Case 2. This is a deep sub-tree: export it as a list item. - ;; Also export as items headlines for which no section - ;; format has been found. - ((org-export-low-level-p headline info) - ;; Build the real contents of the sub-tree. - (let* ((type (if numberedp 'ordered 'unordered)) - (itemized-body (org-html-format-list-item - contents type nil info nil full-text))) - (concat - (and (org-export-first-sibling-p headline info) - (org-html-begin-plain-list type)) - itemized-body - (and (org-export-last-sibling-p headline info) - (org-html-end-plain-list type))))) - ;; Case 3. Standard headline. Export it as a section. - (t - (let* ((section-number (mapconcat 'number-to-string - (org-export-get-headline-number - headline info) "-")) - (ids (remove 'nil - (list (org-element-property :CUSTOM_ID headline) - (concat "sec-" section-number) - (org-element-property :ID headline)))) - (preferred-id (car ids)) - (extra-ids (cdr ids)) - (extra-class (org-element-property :HTML_CONTAINER_CLASS headline)) - (level1 (+ level (1- org-html-toplevel-hlevel))) - (first-content (car (org-element-contents headline)))) - (format "<%s id=\"%s\" class=\"%s\">%s%s\n" - (org-html--container headline info) - (format "outline-container-%s" - (or (org-element-property :CUSTOM_ID headline) - (concat "sec-" section-number))) - (concat (format "outline-%d" level1) (and extra-class " ") - extra-class) - (format "\n%s%s\n" - level1 - preferred-id - (mapconcat - (lambda (x) - (let ((id (org-export-solidify-link-text - (if (org-uuidgen-p x) (concat "ID-" x) - x)))) - (org-html--anchor id))) - extra-ids "") - full-text - level1) - ;; When there is no section, pretend there is an empty - ;; one to get the correct
%s%s\n" + (org-html--container headline info) + (format "outline-container-%s" + (or (org-element-property :CUSTOM_ID headline) + (concat "sec-" section-number))) + (concat (format "outline-%d" level1) (and extra-class " ") + extra-class) + (format "\n%s%s\n" + level1 preferred-id extra-ids full-text level1) + ;; When there is no section, pretend there is an + ;; empty one to get the correct
(incf link-count) 1) - (not (org-html-inline-image-p obj info)))) - (otherwise t))) - info 'first-match 'link)))))) + (catch 'exit + (let ((link-count 0)) + (org-element-map (org-element-contents paragraph) + (cons 'plain-text org-element-all-objects) + #'(lambda (obj) + (when (case (org-element-type obj) + (plain-text (org-string-nw-p obj)) + (link (or (> (incf link-count) 1) + (not (org-html-inline-image-p obj info)))) + (otherwise t)) + (throw 'exit nil))) + info nil 'link) + (= link-count 1)))))) (defun org-html-link (link desc info) "Transcode a LINK object from Org to HTML. @@ -2719,7 +2707,7 @@ ;; link's description. ((string= type "radio") (let ((destination (org-export-resolve-radio-link link info))) - (when destination + (if (not destination) desc (format "%s" (org-export-solidify-link-text (org-element-property :value destination)) === modified file 'lisp/org/ox-icalendar.el' --- lisp/org/ox-icalendar.el 2014-01-07 13:22:53 +0000 +++ lisp/org/ox-icalendar.el 2014-10-03 08:13:51 +0000 @@ -174,8 +174,7 @@ (defcustom org-icalendar-include-sexps t "Non-nil means export to iCalendar files should also cover sexp entries. -These are entries like in the diary, but directly in an Org mode -file." +These are entries like in the diary, but directly in an Org file." :group 'org-export-icalendar :type 'boolean) @@ -302,14 +301,14 @@ INFO is a plist used as a communication channel. -a headline is blocked when either: - - - It has children which are not all in a completed state. - - - It has a parent with the property :ORDERED:, and there are - siblings prior to it with incomplete status. - - - Its parent is blocked because it has siblings that should be +A headline is blocked when either + + - it has children which are not all in a completed state; + + - it has a parent with the property :ORDERED:, and there are + siblings prior to it with incomplete status; + + - its parent is blocked because it has siblings that should be done first or is a child of a blocked grandparent entry." (or ;; Check if any child is not done. @@ -478,10 +477,10 @@ ;;; Filters (defun org-icalendar-clear-blank-lines (headline back-end info) - "Remove trailing blank lines in HEADLINE export. + "Remove blank lines in HEADLINE export. HEADLINE is a string representing a transcoded headline. BACK-END and INFO are ignored." - (replace-regexp-in-string "^\\(?:[ \t]*\n\\)*" "" headline)) + (replace-regexp-in-string "^\\(?:[ \t]*\n\\)+" "" headline)) @@ -570,13 +569,19 @@ ;; happen once ENTRY is one of them. (let ((counter 0)) (mapconcat - 'identity + #'identity (org-element-map (cons (org-element-property :title entry) (org-element-contents inside)) 'timestamp (lambda (ts) - (let ((uid (format "TS%d-%s" (incf counter) uid))) - (org-icalendar--vevent entry ts uid summary loc desc cat))) + (when (let ((type (org-element-property :type ts))) + (case (plist-get info :with-timestamps) + (active (memq type '(active active-range))) + (inactive (memq type '(inactive inactive-range))) + ((t) t))) + (let ((uid (format "TS%d-%s" (incf counter) uid))) + (org-icalendar--vevent + entry ts uid summary loc desc cat)))) info nil (and (eq type 'headline) 'inlinetask)) "")) ;; Task: First check if it is appropriate to export it. @@ -589,7 +594,7 @@ (and (eq type 'headline) (not (org-icalendar-blocked-headline-p entry info)))) - ('t (eq todo-type 'todo)))) + ((t) (eq todo-type 'todo)))) (org-icalendar--vtodo entry uid summary loc desc cat)) ;; Diary-sexp: Collect every diary-sexp element within ;; ENTRY and its title, and transcode them. If ENTRY is @@ -597,7 +602,7 @@ ;; separately. (when org-icalendar-include-sexps (let ((counter 0)) - (mapconcat 'identity + (mapconcat #'identity (org-element-map (cons (org-element-property :title entry) (org-element-contents inside)) @@ -613,7 +618,7 @@ ;; inlinetask within it. In agenda export, this is independent ;; from the mark (or lack thereof) on the entry. (when (eq type 'headline) - (mapconcat 'identity + (mapconcat #'identity (org-element-map inside 'inlinetask (lambda (task) (org-icalendar-entry task nil info)) info) "")) === modified file 'lisp/org/ox-latex.el' --- lisp/org/ox-latex.el 2014-04-22 14:07:45 +0000 +++ lisp/org/ox-latex.el 2014-10-03 08:13:51 +0000 @@ -524,7 +524,7 @@ :package-version '(Org . "8.0") :type '(choice (string :tag "Format string") - (const :tag "No formatting"))) + (const :tag "No formatting" nil))) ;;;; Text markup @@ -689,9 +689,9 @@ a list containing two strings: the name of the option, and the value. For example, - (setq org-latex-listings-options + \(setq org-latex-listings-options '((\"basicstyle\" \"\\\\small\") - (\"keywordstyle\" \"\\\\color{black}\\\\bfseries\\\\underbar\"))) + \(\"keywordstyle\" \"\\\\color{black}\\\\bfseries\\\\underbar\"))) will typeset the code in a small size font with underlined, bold black keywords. @@ -1526,17 +1526,16 @@ (when priority (format "\\framebox{\\#%c} " priority)) title (when tags (format "\\hfill{}\\textsc{:%s:}" - (mapconcat 'identity tags ":")))))) - (format (concat "\\begin{center}\n" - "\\fbox{\n" - "\\begin{minipage}[c]{.6\\textwidth}\n" - "%s\n\n" - "\\rule[.8em]{\\textwidth}{2pt}\n\n" - "%s" - "\\end{minipage}\n" - "}\n" - "\\end{center}") - full-title contents)))))) + (mapconcat #'identity tags ":")))))) + (concat "\\begin{center}\n" + "\\fbox{\n" + "\\begin{minipage}[c]{.6\\textwidth}\n" + full-title "\n\n" + (and (org-string-nw-p contents) + (concat "\\rule[.8em]{\\textwidth}{2pt}\n\n" contents)) + "\\end{minipage}\n" + "}\n" + "\\end{center}")))))) ;;;; Italic @@ -1810,7 +1809,7 @@ ;; description. ((string= type "radio") (let ((destination (org-export-resolve-radio-link link info))) - (when destination + (if (not destination) desc (format "\\hyperref[%s]{%s}" (org-export-solidify-link-text (org-element-property :value destination)) @@ -1843,7 +1842,8 @@ 'number-to-string (org-export-get-headline-number destination info) "-")))) - (if (and (plist-get info :section-numbers) (not desc)) + (if (and (not desc) + (org-export-numbered-headline-p destination info)) (format "\\ref{%s}" label) (format "\\hyperref[%s]{%s}" label (or desc === modified file 'lisp/org/ox-md.el' --- lisp/org/ox-md.el 2014-04-22 14:07:45 +0000 +++ lisp/org/ox-md.el 2014-10-03 08:13:51 +0000 @@ -102,21 +102,28 @@ TREE is the parse tree being exported. BACKEND is the export back-end used. INFO is a plist used as a communication channel. -Make sure there's no blank line before a plain list, unless it is -located right after a paragraph. Otherwise, add a blank line -between elements. Blank lines between items are preserved. +Enforce a blank line between elements. There are three +exceptions to this rule: + + 1. Preserve blank lines between sibling items in a plain list, + + 2. Outside of plain lists, preserve blank lines between + a paragraph and a plain list, + + 3. In an item, remove any blank line before the very first + paragraph and the next sub-list. Assume BACKEND is `md'." (org-element-map tree (remq 'item org-element-all-elements) - (lambda (elem) - (org-element-put-property - elem :post-blank - (if (and (eq (org-element-type (org-export-get-next-element elem info)) - 'plain-list) - (not (and (eq (org-element-type elem) 'paragraph) - (org-export-get-previous-element elem info)))) - 0 - 1)))) + (lambda (e) + (cond + ((not (and (eq (org-element-type e) 'paragraph) + (eq (org-element-type (org-export-get-next-element e info)) + 'plain-list))) + (org-element-put-property e :post-blank 1)) + ((not (eq (org-element-type (org-element-property :parent e)) 'item))) + (t (org-element-put-property + e :post-blank (if (org-export-get-previous-element e info) 1 0)))))) ;; Return updated tree. tree) @@ -182,6 +189,14 @@ (and (plist-get info :with-priority) (let ((char (org-element-property :priority headline))) (and char (format "[#%c] " char))))) + (anchor + (when (plist-get info :with-toc) + (org-html--anchor + (or (org-element-property :CUSTOM_ID headline) + (concat "sec-" + (mapconcat 'number-to-string + (org-export-get-headline-number + headline info) "-")))))) ;; Headline text without tags. (heading (concat todo priority title))) (cond @@ -202,12 +217,12 @@ (replace-regexp-in-string "^" " " contents))))) ;; Use "Setext" style. ((eq org-md-headline-style 'setext) - (concat heading tags "\n" + (concat heading tags anchor "\n" (make-string (length heading) (if (= level 1) ?= ?-)) "\n\n" contents)) ;; Use "atx" style. - (t (concat (make-string level ?#) " " heading tags "\n\n" contents)))))) + (t (concat (make-string level ?#) " " heading tags anchor "\n\n" contents)))))) ;;;; Horizontal Rule @@ -279,57 +294,65 @@ (concat (file-name-sans-extension raw-path) ".md") raw-path)))) (type (org-element-property :type link))) - (cond ((member type '("custom-id" "id")) - (let ((destination (org-export-resolve-id-link link info))) - (if (stringp destination) ; External file. - (let ((path (funcall link-org-files-as-md destination))) - (if (not contents) (format "<%s>" path) - (format "[%s](%s)" contents path))) - (concat - (and contents (concat contents " ")) - (format "(%s)" - (format (org-export-translate "See section %s" :html info) - (mapconcat 'number-to-string - (org-export-get-headline-number - destination info) - "."))))))) - ((org-export-inline-image-p link org-html-inline-image-rules) - (let ((path (let ((raw-path (org-element-property :path link))) - (if (not (file-name-absolute-p raw-path)) raw-path - (expand-file-name raw-path)))) - (caption (org-export-data - (org-export-get-caption - (org-export-get-parent-element link)) info))) - (format "![img](%s)" - (if (not (org-string-nw-p caption)) path - (format "%s \"%s\"" path caption))))) - ((string= type "coderef") - (let ((ref (org-element-property :path link))) - (format (org-export-get-coderef-format ref contents) - (org-export-resolve-coderef ref info)))) - ((equal type "radio") contents) - ((equal type "fuzzy") - (let ((destination (org-export-resolve-fuzzy-link link info))) - (if (org-string-nw-p contents) contents - (when destination - (let ((number (org-export-get-ordinal destination info))) - (when number - (if (atom number) (number-to-string number) - (mapconcat 'number-to-string number ".")))))))) - (t (let* ((raw-path (org-element-property :path link)) - (path - (cond - ((member type '("http" "https" "ftp")) - (concat type ":" raw-path)) - ((string= type "file") - (let ((path (funcall link-org-files-as-md raw-path))) - (if (not (file-name-absolute-p path)) path - ;; If file path is absolute, prepend it - ;; with "file:" component. - (concat "file:" path)))) - (t raw-path)))) - (if (not contents) (format "<%s>" path) - (format "[%s](%s)" contents path))))))) + (cond + ((member type '("custom-id" "id")) + (let ((destination (org-export-resolve-id-link link info))) + (if (stringp destination) ; External file. + (let ((path (funcall link-org-files-as-md destination))) + (if (not contents) (format "<%s>" path) + (format "[%s](%s)" contents path))) + (concat + (and contents (concat contents " ")) + (format "(%s)" + (format (org-export-translate "See section %s" :html info) + (mapconcat 'number-to-string + (org-export-get-headline-number + destination info) + "."))))))) + ((org-export-inline-image-p link org-html-inline-image-rules) + (let ((path (let ((raw-path (org-element-property :path link))) + (if (not (file-name-absolute-p raw-path)) raw-path + (expand-file-name raw-path)))) + (caption (org-export-data + (org-export-get-caption + (org-export-get-parent-element link)) info))) + (format "![img](%s)" + (if (not (org-string-nw-p caption)) path + (format "%s \"%s\"" path caption))))) + ((string= type "coderef") + (let ((ref (org-element-property :path link))) + (format (org-export-get-coderef-format ref contents) + (org-export-resolve-coderef ref info)))) + ((equal type "radio") contents) + ((equal type "fuzzy") + (let ((destination (org-export-resolve-fuzzy-link link info))) + (if (org-string-nw-p contents) contents + (when destination + (let ((number (org-export-get-ordinal destination info))) + (when number + (if (atom number) (number-to-string number) + (mapconcat 'number-to-string number ".")))))))) + ;; Link type is handled by a special function. + ((let ((protocol (nth 2 (assoc type org-link-protocols)))) + (and (functionp protocol) + (funcall protocol + (org-link-unescape (org-element-property :path link)) + contents + 'md)))) + (t (let* ((raw-path (org-element-property :path link)) + (path + (cond + ((member type '("http" "https" "ftp")) + (concat type ":" raw-path)) + ((string= type "file") + (let ((path (funcall link-org-files-as-md raw-path))) + (if (not (file-name-absolute-p path)) path + ;; If file path is absolute, prepend it + ;; with "file:" component. + (concat "file:" path)))) + (t raw-path)))) + (if (not contents) (format "<%s>" path) + (format "[%s](%s)" contents path))))))) ;;;; Paragraph === modified file 'lisp/org/ox-odt.el' --- lisp/org/ox-odt.el 2014-05-29 03:45:29 +0000 +++ lisp/org/ox-odt.el 2014-10-03 15:44:46 +0000 @@ -1741,7 +1741,8 @@ :transcoders '((paragraph . (lambda (p c i) (org-odt--format-paragraph - p c "Footnote" + p c i + "Footnote" "OrgFootnoteCenter" "OrgFootnoteQuotations"))))) info)))) @@ -2732,7 +2733,7 @@ ;; link's description. ((string= type "radio") (let ((destination (org-export-resolve-radio-link link info))) - (when destination + (if (not destination) desc (format "%s" (org-export-solidify-link-text @@ -2832,33 +2833,44 @@ ;;;; Paragraph -(defun org-odt--format-paragraph (paragraph contents default center quote) +(defun org-odt--paragraph-style (paragraph) + "Return style of PARAGRAPH. +Style is a symbol among `quoted', `centered' and nil." + (let ((up paragraph)) + (while (and (setq up (org-element-property :parent up)) + (not (memq (org-element-type up) + '(center-block quote-block section))))) + (case (org-element-type up) + (center-block 'centered) + (quote-block 'quoted)))) + +(defun org-odt--format-paragraph (paragraph contents info default center quote) "Format paragraph according to given styles. PARAGRAPH is a paragraph type element. CONTENTS is the -transcoded contents of that paragraph, as a string. DEFAULT, -CENTER and QUOTE are, respectively, style to use when paragraph -belongs to no special environment, a center block, or a quote -block." - (let* ((parent (org-export-get-parent paragraph)) - (parent-type (org-element-type parent)) - (style (case parent-type - (quote-block quote) - (center-block center) - (t default)))) - ;; If this paragraph is a leading paragraph in an item and the - ;; item has a checkbox, splice the checkbox and paragraph contents - ;; together. - (when (and (eq (org-element-type parent) 'item) - (eq paragraph (car (org-element-contents parent)))) - (setq contents (concat (org-odt--checkbox parent) contents))) - (format "\n%s" style contents))) +transcoded contents of that paragraph, as a string. INFO is +a plist used as a communication channel. DEFAULT, CENTER and +QUOTE are, respectively, style to use when paragraph belongs to +no special environment, a center block, or a quote block." + (format "\n%s" + (case (org-odt--paragraph-style paragraph) + (quoted quote) + (centered center) + (otherwise default)) + ;; If PARAGRAPH is a leading paragraph in an item that has + ;; a checkbox, splice checkbox and paragraph contents + ;; together. + (concat (let ((parent (org-element-property :parent paragraph))) + (and (eq (org-element-type parent) 'item) + (not (org-export-get-previous-element paragraph info)) + (org-odt--checkbox parent))) + contents))) (defun org-odt-paragraph (paragraph contents info) "Transcode a PARAGRAPH element from Org to ODT. CONTENTS is the contents of the paragraph, as a string. INFO is the plist used as a communication channel." (org-odt--format-paragraph - paragraph contents + paragraph contents info (or (org-element-property :style paragraph) "Text_20_body") "OrgCenter" "Quotations")) === modified file 'lisp/org/ox-org.el' --- lisp/org/ox-org.el 2014-05-29 03:45:29 +0000 +++ lisp/org/ox-org.el 2014-10-03 15:44:46 +0000 @@ -65,7 +65,7 @@ (entity . org-org-identity) (example-block . org-org-identity) (fixed-width . org-org-identity) - (footnote-definition . org-org-identity) + (footnote-definition . ignore) (footnote-reference . org-org-identity) (headline . org-org-headline) (horizontal-rule . org-org-identity) @@ -87,7 +87,7 @@ (quote-block . org-org-identity) (quote-section . org-org-identity) (radio-target . org-org-identity) - (section . org-org-identity) + (section . org-org-section) (special-block . org-org-identity) (src-block . org-org-identity) (statistics-cookie . org-org-identity) @@ -122,15 +122,16 @@ (defun org-org-headline (headline contents info) "Transcode HEADLINE element back into Org syntax. CONTENTS is its contents, as a string or nil. INFO is ignored." - (unless (plist-get info :with-todo-keywords) - (org-element-put-property headline :todo-keyword nil)) - (unless (plist-get info :with-tags) - (org-element-put-property headline :tags nil)) - (unless (plist-get info :with-priority) - (org-element-put-property headline :priority nil)) - (org-element-put-property headline :level - (org-export-get-relative-level headline info)) - (org-element-headline-interpreter headline contents)) + (unless (org-element-property :footnote-section-p headline) + (unless (plist-get info :with-todo-keywords) + (org-element-put-property headline :todo-keyword nil)) + (unless (plist-get info :with-tags) + (org-element-put-property headline :tags nil)) + (unless (plist-get info :with-priority) + (org-element-put-property headline :priority nil)) + (org-element-put-property headline :level + (org-export-get-relative-level headline info)) + (org-element-headline-interpreter headline contents))) (defun org-org-keyword (keyword contents info) "Transcode KEYWORD element back into Org syntax. @@ -144,6 +145,33 @@ org-element-block-name-alist)) (org-element-keyword-interpreter keyword nil))) +(defun org-org-section (section contents info) + "Transcode SECTION element back into Org syntax. +CONTENTS is the contents of the section. INFO is a plist used as +a communication channel." + (concat + (org-element-normalize-string contents) + ;; Insert footnote definitions appearing for the first time in this + ;; section. Indeed, some of them may not be available to narrowing + ;; so we make sure all of them are included in the result. + (let ((footnotes-alist + (org-element-map section 'footnote-reference + (lambda (fn) + (and (eq (org-element-property :type fn) 'standard) + (org-export-footnote-first-reference-p fn info) + (cons (org-element-property :label fn) + (org-export-get-footnote-definition fn info)))) + info))) + (and footnotes-alist + (concat "\n" + (mapconcat + (lambda (d) + (org-element-normalize-string + (concat (format "[%s] "(car d)) + (org-export-data (cdr d) info)))) + footnotes-alist "\n")))) + (make-string (or (org-element-property :post-blank section) 0) ?\n))) + ;;;###autoload (defun org-org-export-as-org (&optional async subtreep visible-only ext-plist) "Export current buffer to an Org buffer. === modified file 'lisp/org/ox-publish.el' --- lisp/org/ox-publish.el 2014-04-22 14:07:45 +0000 +++ lisp/org/ox-publish.el 2014-10-03 08:13:51 +0000 @@ -805,9 +805,14 @@ (visiting (find-buffer-visiting file)) (buffer (or visiting (find-file-noselect file)))) (with-current-buffer buffer - (org-mode) (let ((title - (let ((property (plist-get (org-export-get-environment) :title))) + (let ((property + (plist-get + ;; protect local variables in open buffers + (if visiting + (org-export-with-buffer-copy (org-export-get-environment)) + (org-export-get-environment)) + :title))) (if property (org-no-properties (org-element-interpret-data property)) (file-name-nondirectory (file-name-sans-extension file)))))) @@ -822,12 +827,14 @@ any other case use the file system's modification time. Return time in `current-time' format." (if (file-directory-p file) (nth 5 (file-attributes file)) - (let* ((visiting (find-buffer-visiting file)) + (let* ((org-inhibit-startup t) + (visiting (find-buffer-visiting file)) (file-buf (or visiting (find-file-noselect file nil))) (date (plist-get (with-current-buffer file-buf - (let ((org-inhibit-startup t)) (org-mode)) - (org-export-get-environment)) + (if visiting + (org-export-with-buffer-copy (org-export-get-environment)) + (org-export-get-environment))) :date))) (unless visiting (kill-buffer file-buf)) ;; DATE is either a timestamp object or a secondary string. If it === modified file 'lisp/org/ox-texinfo.el' --- lisp/org/ox-texinfo.el 2014-04-22 14:07:45 +0000 +++ lisp/org/ox-texinfo.el 2014-10-03 08:13:51 +0000 @@ -21,38 +21,7 @@ ;;; Commentary: ;; -;; This library implements a Texinfo back-end for Org generic -;; exporter. -;; -;; To test it, run -;; -;; M-: (org-export-to-buffer 'texinfo "*Test Texinfo*") RET -;; -;; in an Org mode buffer then switch to the buffer to see the Texinfo -;; export. See ox.el for more details on how this exporter works. -;; - -;; It introduces nine new buffer keywords: "TEXINFO_CLASS", -;; "TEXINFO_FILENAME", "TEXINFO_HEADER", "TEXINFO_POST_HEADER", -;; "TEXINFO_DIR_CATEGORY", "TEXINFO_DIR_TITLE", "TEXINFO_DIR_DESC" -;; "SUBTITLE" and "SUBAUTHOR". - -;; -;; It introduces 1 new headline property keywords: -;; "TEXINFO_MENU_TITLE" for optional menu titles. -;; -;; To include inline code snippets (for example for generating @kbd{} -;; and @key{} commands), the following export-snippet keys are -;; accepted: -;; -;; texinfo -;; info -;; -;; You can add them for export snippets via any of the below: -;; -;; (add-to-list 'org-export-snippet-translation-alist -;; '("info" . "texinfo")) -;; +;; See Org manual for details. ;;; Code: @@ -70,8 +39,8 @@ (center-block . org-texinfo-center-block) (clock . org-texinfo-clock) (code . org-texinfo-code) - (comment . org-texinfo-comment) - (comment-block . org-texinfo-comment-block) + (comment . (lambda (&rest args) "")) + (comment-block . (lambda (&rest args) "")) (drawer . org-texinfo-drawer) (dynamic-block . org-texinfo-dynamic-block) (entity . org-texinfo-entity) @@ -114,13 +83,14 @@ :export-block "TEXINFO" :filters-alist '((:filter-headline . org-texinfo-filter-section-blank-lines) + (:filter-parse-tree . org-texinfo--normalize-headlines) (:filter-section . org-texinfo-filter-section-blank-lines)) :menu-entry '(?i "Export to Texinfo" ((?t "As TEXI file" org-texinfo-export-to-texinfo) (?i "As INFO file" org-texinfo-export-to-info))) :options-alist - '((:texinfo-filename "TEXINFO_FILENAME" nil org-texinfo-filename t) + '((:texinfo-filename "TEXINFO_FILENAME" nil nil t) (:texinfo-class "TEXINFO_CLASS" nil org-texinfo-default-class t) (:texinfo-header "TEXINFO_HEADER" nil nil newline) (:texinfo-post-header "TEXINFO_POST_HEADER" nil nil newline) @@ -128,7 +98,8 @@ (:subauthor "SUBAUTHOR" nil nil newline) (:texinfo-dircat "TEXINFO_DIR_CATEGORY" nil nil t) (:texinfo-dirtitle "TEXINFO_DIR_TITLE" nil nil t) - (:texinfo-dirdesc "TEXINFO_DIR_DESC" nil nil t))) + (:texinfo-dirdesc "TEXINFO_DIR_DESC" nil nil t) + (:texinfo-printed-title "TEXINFO_PRINTED_TITLE" nil nil t))) @@ -141,12 +112,7 @@ :package-version '(Org . "8.0") :group 'org-export) -;;; Preamble - -(defcustom org-texinfo-filename "" - "Default filename for Texinfo output." - :group 'org-export-texinfo - :type '(string :tag "Export Filename")) +;;;; Preamble (defcustom org-texinfo-coding-system nil "Default document encoding for Texinfo output. @@ -162,19 +128,42 @@ (defcustom org-texinfo-classes '(("info" - "\\input texinfo @c -*- texinfo -*-" + "@documentencoding AUTO\n@documentlanguage AUTO" ("@chapter %s" . "@unnumbered %s") ("@section %s" . "@unnumberedsec %s") ("@subsection %s" . "@unnumberedsubsec %s") ("@subsubsection %s" . "@unnumberedsubsubsec %s"))) "Alist of Texinfo classes and associated header and structure. -If #+Texinfo_CLASS is set in the buffer, use its value and the +If #+TEXINFO_CLASS is set in the buffer, use its value and the associated information. Here is the structure of each cell: \(class-name header-string - \(numbered-section . unnumbered-section\) - ...\) + \(numbered-section . unnumbered-section) + ...) + + +The header string +----------------- + +The header string is inserted in the header of the generated +document, right after \"@setfilename\" and \"@settitle\" +commands. + +If it contains the special string + + \"@documentencoding AUTO\" + +\"AUTO\" will be replaced with an appropriate coding system. See +`org-texinfo-coding-system' for more information. Likewise, if +the string contains the special string + + \"@documentlanguage AUTO\" + +\"AUTO\" will be replaced with the language defined in the +buffer, through #+LANGUAGE keyword, or globally, with +`org-export-default-language', which see. + The sectioning structure ------------------------ @@ -186,10 +175,12 @@ Instead of a list of sectioning commands, you can also specify a function name. That function will be called with two -parameters, the \(reduced) level of the headline, and a predicate +parameters, the reduced) level of the headline, and a predicate non-nil when the headline should be numbered. It must return a format string in which the section title will be added." :group 'org-export-texinfo + :version "24.4" + :package-version '(Org . "8.2") :type '(repeat (list (string :tag "Texinfo class") (string :tag "Texinfo header") @@ -200,7 +191,7 @@ (string :tag "unnumbered")) (function :tag "Hook computing sectioning")))))) -;;; Headline +;;;; Headline (defcustom org-texinfo-format-headline-function 'ignore "Function to format headline text. @@ -230,22 +221,16 @@ :group 'org-export-texinfo :type 'function) -;;; Node listing (menu) +;;;; Node listing (menu) (defcustom org-texinfo-node-description-column 32 - "Column at which to start the description in the node - listings. - + "Column at which to start the description in the node listings. If a node title is greater than this length, the description will be placed after the end of the title." :group 'org-export-texinfo :type 'integer) -;;; Footnotes -;; -;; Footnotes are inserted directly - -;;; Timestamps +;;;; Timestamps (defcustom org-texinfo-active-timestamp-format "@emph{%s}" "A printf format string to be applied to active timestamps." @@ -262,14 +247,14 @@ :group 'org-export-texinfo :type 'string) -;;; Links +;;;; Links (defcustom org-texinfo-link-with-unknown-path-format "@indicateurl{%s}" "Format string for links with unknown path type." :group 'org-export-texinfo :type 'string) -;;; Tables +;;;; Tables (defcustom org-texinfo-tables-verbatim nil "When non-nil, tables are exported verbatim." @@ -285,14 +270,14 @@ :group 'org-export-texinfo :type '(choice (string :tag "Format string") - (const :tag "No formatting"))) + (const :tag "No formatting" nil))) (defcustom org-texinfo-def-table-markup "@samp" "Default setting for @table environments." :group 'org-export-texinfo :type 'string) -;;; Text markup +;;;; Text markup (defcustom org-texinfo-text-markup-alist '((bold . "@strong{%s}") (code . code) @@ -316,7 +301,7 @@ :type 'alist :options '(bold code italic verbatim comment)) -;;; Drawers +;;;; Drawers (defcustom org-texinfo-format-drawer-function (lambda (name contents) contents) @@ -331,10 +316,10 @@ The default function simply returns the value of CONTENTS." :group 'org-export-texinfo :version "24.4" - :package-version '(Org . "8.3") + :package-version '(Org . "8.2") :type 'function) -;;; Inlinetasks +;;;; Inlinetasks (defcustom org-texinfo-format-inlinetask-function 'ignore "Function called to format an inlinetask in Texinfo code. @@ -370,18 +355,13 @@ :group 'org-export-texinfo :type 'function) -;;; Src blocks -;; -;; Src Blocks are example blocks, except for LISP - -;;; Compilation - -(defcustom org-texinfo-info-process - '("makeinfo %f") +;;;; Compilation + +(defcustom org-texinfo-info-process '("makeinfo %f") "Commands to process a Texinfo file to an INFO file. This is list of strings, each of them will be given to the shell as a command. %f in the command will be replaced by the full -file name, %b by the file base name \(i.e without extension) and +file name, %b by the file base name (i.e without extension) and %o by the base directory of the file." :group 'org-export-texinfo :type '(repeat :tag "Shell command sequence" @@ -403,12 +383,13 @@ :group 'org-export-latex :type 'boolean) - ;;; Constants + (defconst org-texinfo-max-toc-depth 4 - "Maximum depth for creation of detailed menu listings. Beyond - this depth Texinfo will not recognize the nodes and will cause - errors. Left as a constant in case this value ever changes.") + "Maximum depth for creation of detailed menu listings. +Beyond this depth, Texinfo will not recognize the nodes and will +cause errors. Left as a constant in case this value ever +changes.") (defconst org-texinfo-supported-coding-systems '("US-ASCII" "UTF-8" "ISO-8859-15" "ISO-8859-1" "ISO-8859-2" "koi8-r" "koi8-u") @@ -425,6 +406,31 @@ (let ((blanks (make-string 2 ?\n))) (replace-regexp-in-string "\n\\(?:\n[ \t]*\\)*\\'" blanks headline))) +(defun org-texinfo--normalize-headlines (tree back-end info) + "Normalize headlines in TREE. + +BACK-END is the symbol specifying back-end used for export. INFO +is a plist used as a communication channel. + +Make sure every headline in TREE contains a section, since those +are required to install a menu. Also put exactly one blank line +at the end of each section. + +Return new tree." + (org-element-map tree 'headline + (lambda (hl) + (org-element-put-property hl :post-blank 1) + (let ((contents (org-element-contents hl))) + (when contents + (let ((first (org-element-map contents '(headline section) + #'identity info t))) + (unless (eq (org-element-type first) 'section) + (apply #'org-element-set-contents + hl + (cons `(section (:parent ,hl)) contents))))))) + info) + tree) + (defun org-texinfo--find-verb-separator (s) "Return a character not used in string S. This is used to choose a separator for constructs like \\verb." @@ -433,18 +439,6 @@ when (not (string-match (regexp-quote (char-to-string c)) s)) return (char-to-string c)))) -(defun org-texinfo--make-option-string (options) - "Return a comma separated string of keywords and values. -OPTIONS is an alist where the key is the options keyword as -a string, and the value a list containing the keyword value, or -nil." - (mapconcat (lambda (pair) - (concat (first pair) - (when (> (length (second pair)) 0) - (concat "=" (second pair))))) - options - ",")) - (defun org-texinfo--text-markup (text markup) "Format TEXT depending on MARKUP text markup. See `org-texinfo-text-markup-alist' for details." @@ -472,207 +466,44 @@ ;; Else use format string. (t (format fmt text))))) -(defun org-texinfo--get-node (headline info) - "Return node entry associated to HEADLINE. -INFO is a plist used as a communication channel." - (let ((menu-title (org-export-get-alt-title headline info))) - (org-texinfo--sanitize-menu - (replace-regexp-in-string - "%" "%%" - (if menu-title (org-export-data menu-title info) - (org-texinfo--sanitize-headline - (org-element-property :title headline) info)))))) - -;;; Headline sanitizing - -(defun org-texinfo--sanitize-headline (headline info) - "Remove all formatting from the text of a headline for use in - node and menu listing." - (mapconcat 'identity - (org-texinfo--sanitize-headline-contents headline info) " ")) - -(defun org-texinfo--sanitize-headline-contents (headline info) - "Retrieve the content of the headline. - -Any content that can contain further formatting is checked -recursively, to ensure that nested content is also properly -retrieved." - (loop for contents in headline append - (cond - ;; already a string - ((stringp contents) - (list (replace-regexp-in-string " $" "" contents))) - ;; Is exported as-is (value) - ((org-element-map contents '(verbatim code) - (lambda (value) (org-element-property :value value)) info)) - ;; Has content and recurse into the content - ((org-element-contents contents) - (org-texinfo--sanitize-headline-contents - (org-element-contents contents) info))))) - -;;; Menu sanitizing - -(defun org-texinfo--sanitize-menu (title) - "Remove invalid characters from TITLE for use in menus and -nodes. - -Based on Texinfo specifications, the following must be removed: -@ { } ( ) : . ," - (replace-regexp-in-string "[@{}():,.]" "" title)) - -;;; Content sanitizing +(defun org-texinfo--get-node (blob info) + "Return node or anchor associated to BLOB. +BLOB is an element or object. INFO is a plist used as +a communication channel. The function guarantees the node or +anchor name is unique." + (let ((cache (plist-get info :texinfo-node-cache))) + (or (cdr (assq blob cache)) + (let ((name + (org-texinfo--sanitize-node + (case (org-element-type blob) + (headline + (org-export-data (org-export-get-alt-title blob info) info)) + ((radio-target target) (org-element-property :value blob)) + (otherwise (or (org-element-property :name blob) "")))))) + ;; Ensure NAME is unique. + (while (rassoc name cache) (setq name (concat name "x"))) + (plist-put info :texinfo-node-cache (cons (cons blob name) cache)) + name)))) + +;;;; Menu sanitizing + +(defun org-texinfo--sanitize-node (title) + "Bend string TITLE to node line requirements. +Trim string and collapse multiple whitespace characters as they +are not significant. Also remove the following characters: @ +{ } ( ) : . ," + (replace-regexp-in-string + "[:,.]" "" + (replace-regexp-in-string + "\\`(\\(.*)\\)" "[\\1" + (org-trim (replace-regexp-in-string "[ \t]\\{2,\\}" " " title))))) + +;;;; Content sanitizing (defun org-texinfo--sanitize-content (text) - "Ensure characters are properly escaped when used in headlines or blocks. - -Escape characters are: @ { }" - (replace-regexp-in-string "\\\([@{}]\\\)" "@\\1" text)) - -;;; Menu creation - -(defun org-texinfo--build-menu (tree level info &optional detailed) - "Create the @menu/@end menu information from TREE at headline -level LEVEL. - -TREE contains the parse-tree to work with, either of the entire -document or of a specific parent headline. LEVEL indicates what -level of headlines to look at when generating the menu. INFO is -a plist containing contextual information. - -Detailed determines whether to build a single level of menu, or -recurse into all children as well." - (let ((menu (org-texinfo--generate-menu-list tree level info)) - output text-menu) - (cond - (detailed - ;; Looping is done within the menu generation. - (setq text-menu (org-texinfo--generate-detailed menu level info))) - (t - (setq text-menu (org-texinfo--generate-menu-items menu info)))) - (when text-menu - (setq output (org-texinfo--format-menu text-menu)) - (mapconcat 'identity output "\n")))) - -(defun org-texinfo--generate-detailed (menu level info) - "Generate a detailed listing of all subheadings within MENU starting at LEVEL. - -MENU is the parse-tree to work with. LEVEL is the starting level -for the menu headlines and from which recursion occurs. INFO is -a plist containing contextual information." - (when level - (let ((max-depth (min org-texinfo-max-toc-depth - (plist-get info :headline-levels)))) - (when (> max-depth level) - (loop for headline in menu append - (let* ((title (org-texinfo--menu-headlines headline info)) - ;; Create list of menu entries for the next level - (sublist (org-texinfo--generate-menu-list - headline (1+ level) info)) - ;; Generate the menu items for that level. If - ;; there are none omit that heading completely, - ;; otherwise join the title to it's related entries. - (submenu (if (org-texinfo--generate-menu-items sublist info) - (append (list title) - (org-texinfo--generate-menu-items sublist info)) - 'nil)) - ;; Start the process over the next level down. - (recursion (org-texinfo--generate-detailed sublist (1+ level) info))) - (setq recursion (append submenu recursion)) - recursion)))))) - -(defun org-texinfo--generate-menu-list (tree level info) - "Generate the list of headlines that are within a given level -of the tree for further formatting. - -TREE is the parse-tree containing the headlines. LEVEL is the -headline level to generate a list of. INFO is a plist holding -contextual information." - (org-element-map tree 'headline - (lambda (head) - (and (= (org-export-get-relative-level head info) level) - ;; Do not take note of footnotes or copying headlines. - (not (org-element-property :COPYING head)) - (not (org-element-property :footnote-section-p head)) - ;; Collect headline. - head)) - info)) - -(defun org-texinfo--generate-menu-items (items info) - "Generate a list of headline information from the listing ITEMS. - -ITEMS is a list of the headlines to be converted into entries. -INFO is a plist containing contextual information. - -Returns a list containing the following information from each -headline: length, title, description. This is used to format the -menu using `org-texinfo--format-menu'." - (loop for headline in items collect - (let* ((menu-title (org-texinfo--sanitize-menu - (org-export-data - (org-export-get-alt-title headline info) - info))) - (title (org-texinfo--sanitize-menu - (org-texinfo--sanitize-headline - (org-element-property :title headline) info))) - (descr (org-export-data - (org-element-property :DESCRIPTION headline) - info)) - (menu-entry (if (string= "" menu-title) title menu-title)) - (len (length menu-entry)) - (output (list len menu-entry descr))) - output))) - -(defun org-texinfo--menu-headlines (headline info) - "Retrieve the title from HEADLINE. - -INFO is a plist holding contextual information. - -Return the headline as a list of (length title description) with -length of -1 and nil description. This is used in -`org-texinfo--format-menu' to identify headlines as opposed to -entries." - (let ((title (org-export-data - (org-element-property :title headline) info))) - (list -1 title 'nil))) - -(defun org-texinfo--format-menu (text-menu) - "Format the TEXT-MENU items to be properly printed in the menu. - -Each entry in the menu should be provided as (length title -description). - -Headlines in the detailed menu are given length -1 to ensure they -are never confused with other entries. They also have no -description. - -Other menu items are output as: - Title:: description - -With the spacing between :: and description based on the length -of the longest menu entry." - - (let (output) - (setq output - (mapcar (lambda (name) - (let* ((title (nth 1 name)) - (desc (nth 2 name)) - (length (nth 0 name)) - (column (max - ;;6 is "* " ":: " for inserted text - length - (- - org-texinfo-node-description-column - 6))) - (spacing (- column length) - )) - (if (> length -1) - (concat "* " title ":: " - (make-string spacing ?\s) - (if desc - (concat desc))) - (concat "\n" title "\n")))) - text-menu)) - output)) + "Escape special characters in string TEXT. +Special characters are: @ { }" + (replace-regexp-in-string "[@{}]" "@\\&" text)) ;;; Template @@ -680,145 +511,127 @@ "Return complete document string after Texinfo conversion. CONTENTS is the transcoded contents string. INFO is a plist holding export options." - (let* ((title (org-export-data (plist-get info :title) info)) - (info-filename (or (plist-get info :texinfo-filename) - (file-name-nondirectory - (org-export-output-file-name ".info")))) - (author (org-export-data (plist-get info :author) info)) - (lang (org-export-data (plist-get info :language) info)) - (texinfo-header (plist-get info :texinfo-header)) - (texinfo-post-header (plist-get info :texinfo-post-header)) - (subtitle (plist-get info :subtitle)) - (subauthor (plist-get info :subauthor)) - (class (plist-get info :texinfo-class)) - (header (nth 1 (assoc class org-texinfo-classes))) - (copying - (org-element-map (plist-get info :parse-tree) 'headline - (lambda (hl) (and (org-element-property :COPYING hl) hl)) info t)) - (dircat (plist-get info :texinfo-dircat)) - (dirtitle (plist-get info :texinfo-dirtitle)) - (dirdesc (plist-get info :texinfo-dirdesc)) - ;; Spacing to align description (column 32 - 3 for `* ' and - ;; `.' in text. - (dirspacing (- 29 (length dirtitle))) - (menu (org-texinfo-make-menu info 'main)) - (detail-menu (org-texinfo-make-menu info 'detailed))) + (let ((title (org-export-data (plist-get info :title) info)) + ;; Copying data is the contents of the first headline in + ;; parse tree with a non-nil copying property. + (copying (org-element-map (plist-get info :parse-tree) 'headline + (lambda (hl) + (and (org-not-nil (org-element-property :COPYING hl)) + (org-element-contents hl))) + info t))) (concat - ;; Header - header "\n" + "\\input texinfo @c -*- texinfo -*-\n" "@c %**start of header\n" - ;; Filename and Title - "@setfilename " info-filename "\n" - "@settitle " title "\n" - ;; Coding system. - (format - "@documentencoding %s\n" - (catch 'coding-system - (let ((case-fold-search t) - (name (symbol-name (or org-texinfo-coding-system - buffer-file-coding-system)))) - (dolist (system org-texinfo-supported-coding-systems "UTF-8") - (when (org-string-match-p (regexp-quote system) name) - (throw 'coding-system system)))))) - "\n" - (format "@documentlanguage %s\n" lang) - "\n\n" - "@c Version and Contact Info\n" - "@set AUTHOR " author "\n" - - ;; Additional Header Options set by `#+TEXINFO_HEADER - (if texinfo-header - (concat "\n" - texinfo-header - "\n")) - - "@c %**end of header\n" - "@finalout\n" - "\n\n" - - ;; Additional Header Options set by #+TEXINFO_POST_HEADER - (if texinfo-post-header - (concat "\n" - texinfo-post-header - "\n")) - - ;; Copying - "@copying\n" - ;; Only export the content of the headline, do not need the - ;; initial headline. - (org-export-data (nth 2 copying) info) - "@end copying\n" - "\n\n" - - ;; Info directory information - ;; Only supply if both title and category are provided - (if (and dircat dirtitle) + (let ((file (or (plist-get info :texinfo-filename) + (let ((f (plist-get info :output-file))) + (and f (concat (file-name-sans-extension f) ".info")))))) + (and file (format "@setfilename %s\n" file))) + (format "@settitle %s\n" title) + ;; Insert class-defined header. + (org-element-normalize-string + (let ((header (nth 1 (assoc (plist-get info :texinfo-class) + org-texinfo-classes))) + (coding + (catch 'coding-system + (let ((case-fold-search t) + (name (symbol-name (or org-texinfo-coding-system + buffer-file-coding-system)))) + (dolist (system org-texinfo-supported-coding-systems "UTF-8") + (when (org-string-match-p (regexp-quote system) name) + (throw 'coding-system system)))))) + (language (plist-get info :language)) + (case-fold-search nil)) + ;; Auto coding system. + (replace-regexp-in-string + "^@documentencoding \\(AUTO\\)$" + coding + (replace-regexp-in-string + "^@documentlanguage \\(AUTO\\)$" language header t nil 1) t nil 1))) + ;; Additional header options set by #+TEXINFO_HEADER. + (let ((texinfo-header (plist-get info :texinfo-header))) + (and texinfo-header (org-element-normalize-string texinfo-header))) + "@c %**end of header\n\n" + ;; Additional options set by #+TEXINFO_POST_HEADER. + (let ((texinfo-post-header (plist-get info :texinfo-post-header))) + (and texinfo-post-header + (org-element-normalize-string texinfo-post-header))) + ;; Copying. + (and copying + (format "@copying\n%s@end copying\n\n" + (org-element-normalize-string + (org-export-data copying info)))) + ;; Info directory information. Only supply if both title and + ;; category are provided. + (let ((dircat (plist-get info :texinfo-dircat)) + (dirtitle + (let ((title (plist-get info :texinfo-dirtitle))) + (and title + (string-match "^\\(?:\\* \\)?\\(.*?\\)\\(\\.\\)?$" title) + (format "* %s." (match-string 1 title)))))) + (when (and dircat dirtitle) (concat "@dircategory " dircat "\n" "@direntry\n" - "* " dirtitle "." - (make-string dirspacing ?\s) - dirdesc "\n" - "@end direntry\n")) - "\n\n" - + (let ((dirdesc + (let ((desc (plist-get info :texinfo-dirdesc))) + (cond ((not desc) nil) + ((org-string-match-p "\\.$" desc) desc) + (t (concat desc ".")))))) + (if dirdesc (format "%-23s %s" dirtitle dirdesc) dirtitle)) + "\n" + "@end direntry\n\n"))) ;; Title + "@finalout\n" "@titlepage\n" - "@title " title "\n\n" - (if subtitle - (concat "@subtitle " subtitle "\n")) - "@author " author "\n" - (if subauthor - (concat subauthor "\n")) - "\n" - "@c The following two commands start the copyright page.\n" - "@page\n" - "@vskip 0pt plus 1filll\n" - "@insertcopying\n" + (format "@title %s\n" (or (plist-get info :texinfo-printed-title) title)) + (let ((subtitle (plist-get info :subtitle))) + (and subtitle + (org-element-normalize-string + (replace-regexp-in-string "^" "@subtitle " subtitle)))) + (when (plist-get info :with-author) + (concat + ;; Primary author. + (let ((author (org-string-nw-p + (org-export-data (plist-get info :author) info))) + (email (and (plist-get info :with-email) + (org-string-nw-p + (org-export-data (plist-get info :email) info))))) + (cond ((and author email) + (format "@author %s (@email{%s})\n" author email)) + (author (format "@author %s\n" author)) + (email (format "@author @email{%s}\n" email)))) + ;; Other authors. + (let ((subauthor (plist-get info :subauthor))) + (and subauthor + (org-element-normalize-string + (replace-regexp-in-string "^" "@author " subauthor)))))) + (and copying "@page\n@vskip 0pt plus 1filll\n@insertcopying\n") "@end titlepage\n\n" - "@c Output the table of contents at the beginning.\n" - "@contents\n\n" - + ;; Table of contents. + (and (plist-get info :with-toc) "@contents\n\n") ;; Configure Top Node when not for Tex "@ifnottex\n" "@node Top\n" - "@top " title " Manual\n" - "@insertcopying\n" + (format "@top %s\n" title) + (and copying "@insertcopying\n") "@end ifnottex\n\n" - - ;; Do not output menus if they are empty - (if menu - ;; Menu - (concat "@menu\n" - menu - "\n\n" - ;; Detailed Menu - (if detail-menu - (concat "@detailmenu\n" - " --- The Detailed Node Listing ---\n" - detail-menu - "\n\n" - "@end detailmenu\n")) - "@end menu\n")) - "\n\n" - + ;; Menu. + (org-texinfo-make-menu (plist-get info :parse-tree) info 'master) + "\n" ;; Document's body. - contents - "\n" + contents "\n" ;; Creator. - (let ((creator-info (plist-get info :with-creator))) - (cond - ((not creator-info) "") - ((eq creator-info 'comment) - (format "@c %s\n" (plist-get info :creator))) - (t (concat (plist-get info :creator) "\n")))) + (case (plist-get info :with-creator) + ((nil) nil) + (comment (format "@c %s\n" (plist-get info :creator))) + (otherwise (concat (plist-get info :creator) "\n"))) ;; Document end. - "\n@bye"))) + "@bye"))) ;;; Transcode Functions -;;; Bold +;;;; Bold (defun org-texinfo-bold (bold contents info) "Transcode BOLD from Org to Texinfo. @@ -826,7 +639,7 @@ contextual information." (org-texinfo--text-markup contents 'bold)) -;;; Center Block +;;;; Center Block (defun org-texinfo-center-block (center-block contents info) "Transcode a CENTER-BLOCK element from Org to Texinfo. @@ -834,7 +647,7 @@ as a communication channel." contents) -;;; Clock +;;;; Clock (defun org-texinfo-clock (clock contents info) "Transcode a CLOCK element from Org to Texinfo. @@ -851,7 +664,7 @@ (and time (format " (%s)" time))))) "@*")) -;;; Code +;;;; Code (defun org-texinfo-code (code contents info) "Transcode a CODE object from Org to Texinfo. @@ -859,23 +672,7 @@ channel." (org-texinfo--text-markup (org-element-property :value code) 'code)) -;;; Comment - -(defun org-texinfo-comment (comment contents info) - "Transcode a COMMENT object from Org to Texinfo. -CONTENTS is the text in the comment. INFO is a plist holding -contextual information." - (org-texinfo--text-markup (org-element-property :value comment) 'comment)) - -;;; Comment Block - -(defun org-texinfo-comment-block (comment-block contents info) - "Transcode a COMMENT-BLOCK object from Org to Texinfo. -CONTENTS is the text within the block. INFO is a plist holding -contextual information." - (format "@ignore\n%s@end ignore" (org-element-property :value comment-block))) - -;;; Drawer +;;;; Drawer (defun org-texinfo-drawer (drawer contents info) "Transcode a DRAWER element from Org to Texinfo. @@ -886,15 +683,15 @@ name contents))) output)) -;;; Dynamic Block +;;;; Dynamic Block (defun org-texinfo-dynamic-block (dynamic-block contents info) "Transcode a DYNAMIC-BLOCK element from Org to Texinfo. CONTENTS holds the contents of the block. INFO is a plist -holding contextual information. See `org-export-data'." +holding contextual information." contents) -;;; Entity +;;;; Entity (defun org-texinfo-entity (entity contents info) "Transcode an ENTITY object from Org to Texinfo. @@ -903,7 +700,7 @@ (let ((ent (org-element-property :latex entity))) (if (org-element-property :latex-math-p entity) (format "@math{%s}" ent) ent))) -;;; Example Block +;;;; Example Block (defun org-texinfo-example-block (example-block contents info) "Transcode an EXAMPLE-BLOCK element from Org to Texinfo. @@ -912,7 +709,7 @@ (format "@verbatim\n%s@end verbatim" (org-export-format-code-default example-block info))) -;;; Export Block +;;;; Export Block (defun org-texinfo-export-block (export-block contents info) "Transcode a EXPORT-BLOCK element from Org to Texinfo. @@ -920,7 +717,7 @@ (when (string= (org-element-property :type export-block) "TEXINFO") (org-remove-indentation (org-element-property :value export-block)))) -;;; Export Snippet +;;;; Export Snippet (defun org-texinfo-export-snippet (export-snippet contents info) "Transcode a EXPORT-SNIPPET object from Org to Texinfo. @@ -928,7 +725,7 @@ (when (eq (org-export-snippet-backend export-snippet) 'texinfo) (org-element-property :value export-snippet))) -;;; Fixed Width +;;;; Fixed Width (defun org-texinfo-fixed-width (fixed-width contents info) "Transcode a FIXED-WIDTH element from Org to Texinfo. @@ -938,8 +735,7 @@ (org-texinfo--sanitize-content (org-element-property :value fixed-width))))) -;;; Footnote Reference -;; +;;;; Footnote Reference (defun org-texinfo-footnote-reference (footnote contents info) "Create a footnote reference for FOOTNOTE. @@ -950,7 +746,7 @@ (format "@footnote{%s}" (org-trim (org-export-data def info))))) -;;; Headline +;;;; Headline (defun org-texinfo-headline (headline contents info) "Transcode a HEADLINE element from Org to Texinfo. @@ -960,66 +756,29 @@ (level (org-export-get-relative-level headline info)) (numberedp (org-export-numbered-headline-p headline info)) (class-sectioning (assoc class org-texinfo-classes)) - ;; Find the index type, if any + ;; Find the index type, if any. (index (org-element-property :INDEX headline)) - ;; Check if it is an appendix - (appendix (org-element-property :APPENDIX headline)) - ;; Retrieve headline text - (text (org-texinfo--sanitize-headline - (org-element-property :title headline) info)) ;; Create node info, to insert it before section formatting. - ;; Use custom menu title if present + ;; Use custom menu title if present. (node (format "@node %s\n" (org-texinfo--get-node headline info))) - ;; Menus must be generated with first child, otherwise they - ;; will not nest properly - (menu (let* ((first (org-export-first-sibling-p headline info)) - (parent (org-export-get-parent-headline headline)) - (title (org-texinfo--sanitize-headline - (org-element-property :title parent) info)) - heading listing - (tree (plist-get info :parse-tree))) - (if first - (org-element-map (plist-get info :parse-tree) 'headline - (lambda (ref) - (if (member title (org-element-property :title ref)) - (push ref heading))) - info t)) - (setq listing (org-texinfo--build-menu - (car heading) level info)) - (if listing - (setq listing (replace-regexp-in-string - "%" "%%" listing) - listing (format - "\n@menu\n%s\n@end menu\n\n" listing)) - 'nil))) ;; Section formatting will set two placeholders: one for the ;; title and the other for the contents. (section-fmt - (let ((sec (if (and (symbolp (nth 2 class-sectioning)) - (fboundp (nth 2 class-sectioning))) - (funcall (nth 2 class-sectioning) level numberedp) - (nth (1+ level) class-sectioning)))) - (cond - ;; No section available for that LEVEL. - ((not sec) nil) - ;; Section format directly returned by a function. - ((stringp sec) sec) - ;; (numbered-section . unnumbered-section) - ((not (consp (cdr sec))) + (if (org-not-nil (org-element-property :APPENDIX headline)) + "@appendix %s\n%s" + (let ((sec (if (and (symbolp (nth 2 class-sectioning)) + (fboundp (nth 2 class-sectioning))) + (funcall (nth 2 class-sectioning) level numberedp) + (nth (1+ level) class-sectioning)))) (cond - ;;If an index, always unnumbered - (index - (concat menu node (cdr sec) "\n%s")) - (appendix - (concat menu node (replace-regexp-in-string - "unnumbered" - "appendix" - (cdr sec)) "\n%s")) - ;; Otherwise number as needed. - (t - (concat menu node - (funcall - (if numberedp #'car #'cdr) sec) "\n%s"))))))) + ;; No section available for that LEVEL. + ((not sec) nil) + ;; Section format directly returned by a function. + ((stringp sec) sec) + ;; (numbered-section . unnumbered-section) + ((not (consp (cdr sec))) + (concat (if (or index (not numberedp)) (cdr sec) (car sec)) + "\n%s")))))) (todo (and (plist-get info :with-todo-keywords) (let ((todo (org-element-property :todo-keyword headline))) @@ -1029,100 +788,54 @@ (org-export-get-tags headline info))) (priority (and (plist-get info :with-priority) (org-element-property :priority headline))) - ;; Create the headline text along with a no-tag version. The - ;; latter is required to remove tags from table of contents. - (full-text (org-texinfo--sanitize-content - (if (not (eq org-texinfo-format-headline-function 'ignore)) - ;; User-defined formatting function. - (funcall org-texinfo-format-headline-function - todo todo-type priority text tags) - ;; Default formatting. - (concat - (when todo - (format "@strong{%s} " todo)) - (when priority (format "@emph{#%s} " priority)) - text - (when tags - (format " :%s:" - (mapconcat 'identity tags ":"))))))) - (full-text-no-tag - (org-texinfo--sanitize-content - (if (not (eq org-texinfo-format-headline-function 'ignore)) - ;; User-defined formatting function. - (funcall org-texinfo-format-headline-function - todo todo-type priority text nil) - ;; Default formatting. - (concat - (when todo (format "@strong{%s} " todo)) - (when priority (format "@emph{#%c} " priority)) - text)))) - (pre-blanks - (make-string (org-element-property :pre-blank headline) 10))) + (text (org-export-data (org-element-property :title headline) info)) + (full-text (if (not (eq org-texinfo-format-headline-function 'ignore)) + ;; User-defined formatting function. + (funcall org-texinfo-format-headline-function + todo todo-type priority text tags) + ;; Default formatting. + (concat + (when todo + (format "@strong{%s} " todo)) + (when priority (format "@emph{#%s} " priority)) + text + (when tags + (format " :%s:" + (mapconcat 'identity tags ":")))))) + (contents (if (org-string-nw-p contents) (concat "\n" contents) ""))) (cond ;; Case 1: This is a footnote section: ignore it. ((org-element-property :footnote-section-p headline) nil) ;; Case 2: This is the `copying' section: ignore it ;; This is used elsewhere. - ((org-element-property :COPYING headline) nil) + ((org-not-nil (org-element-property :COPYING headline)) nil) ;; Case 3: An index. If it matches one of the known indexes, ;; print it as such following the contents, otherwise ;; print the contents and leave the index up to the user. (index - (format - section-fmt full-text - (concat pre-blanks contents "\n" - (if (member index '("cp" "fn" "ky" "pg" "tp" "vr")) - (concat "@printindex " index))))) + (concat node + (format + section-fmt + full-text + (concat contents + (and (member index '("cp" "fn" "ky" "pg" "tp" "vr")) + (concat "\n@printindex " index)))))) ;; Case 4: This is a deep sub-tree: export it as a list item. ;; Also export as items headlines for which no section ;; format has been found. ((or (not section-fmt) (org-export-low-level-p headline info)) ;; Build the real contents of the sub-tree. - (let ((low-level-body - (concat - ;; If the headline is the first sibling, start a list. - (when (org-export-first-sibling-p headline info) - (format "@%s\n" (if numberedp 'enumerate 'itemize))) - ;; Itemize headline - "@item\n" full-text "\n" pre-blanks contents))) - ;; If headline is not the last sibling simply return - ;; LOW-LEVEL-BODY. Otherwise, also close the list, before any - ;; blank line. - (if (not (org-export-last-sibling-p headline info)) low-level-body - (replace-regexp-in-string - "[ \t\n]*\\'" - (format "\n@end %s" (if numberedp 'enumerate 'itemize)) - low-level-body)))) + (concat (and (org-export-first-sibling-p headline info) + (format "@%s\n" (if numberedp 'enumerate 'itemize))) + "@item\n" full-text "\n" + contents + (if (org-export-last-sibling-p headline info) + (format "@end %s" (if numberedp 'enumerate 'itemize)) + "\n"))) ;; Case 5: Standard headline. Export it as a section. - (t - (cond - ((not (and tags (eq (plist-get info :with-tags) 'not-in-toc))) - ;; Regular section. Use specified format string. - (format (replace-regexp-in-string "%]" "%%]" section-fmt) full-text - (concat pre-blanks contents))) - ((string-match "\\`@\\(.*?\\){" section-fmt) - ;; If tags should be removed from table of contents, insert - ;; title without tags as an alternative heading in sectioning - ;; command. - (format (replace-match (concat (match-string 1 section-fmt) "[%s]") - nil nil section-fmt 1) - ;; Replace square brackets with parenthesis since - ;; square brackets are not supported in optional - ;; arguments. - (replace-regexp-in-string - "\\[" "(" - (replace-regexp-in-string - "\\]" ")" - full-text-no-tag)) - full-text - (concat pre-blanks contents))) - (t - ;; Impossible to add an alternative heading. Fallback to - ;; regular sectioning format string. - (format (replace-regexp-in-string "%]" "%%]" section-fmt) full-text - (concat pre-blanks contents)))))))) + (t (concat node (format section-fmt full-text contents)))))) -;;; Inline Src Block +;;;; Inline Src Block (defun org-texinfo-inline-src-block (inline-src-block contents info) "Transcode an INLINE-SRC-BLOCK element from Org to Texinfo. @@ -1132,7 +845,7 @@ (separator (org-texinfo--find-verb-separator code))) (concat "@verb{" separator code separator "}"))) -;;; Inlinetask +;;;; Inlinetask (defun org-texinfo-inlinetask (inlinetask contents info) "Transcode an INLINETASK element from Org to Texinfo. @@ -1165,7 +878,7 @@ "\n") full-title contents))))) -;;; Italic +;;;; Italic (defun org-texinfo-italic (italic contents info) "Transcode ITALIC from Org to Texinfo. @@ -1173,18 +886,18 @@ contextual information." (org-texinfo--text-markup contents 'italic)) -;;; Item +;;;; Item (defun org-texinfo-item (item contents info) "Transcode an ITEM element from Org to Texinfo. CONTENTS holds the contents of the item. INFO is a plist holding contextual information." - (let* ((tag (org-element-property :tag item)) - (desc (org-export-data tag info))) - (concat "\n@item " (if tag desc) "\n" - (and contents (org-trim contents)) "\n"))) + (format "@item%s\n%s" + (let ((tag (org-element-property :tag item))) + (if tag (concat " " (org-export-data tag info)) "")) + (or contents ""))) -;;; Keyword +;;;; Keyword (defun org-texinfo-keyword (keyword contents info) "Transcode a KEYWORD element from Org to Texinfo. @@ -1200,14 +913,14 @@ ((string= key "TINDEX") (format "@tindex %s" value)) ((string= key "VINDEX") (format "@vindex %s" value))))) -;;; Line Break +;;;; Line Break (defun org-texinfo-line-break (line-break contents info) "Transcode a LINE-BREAK object from Org to Texinfo. CONTENTS is nil. INFO is a plist holding contextual information." "@*\n") -;;; Link +;;;; Link (defun org-texinfo-link (link desc info) "Transcode a LINK object from Org to Texinfo. @@ -1225,55 +938,69 @@ ((and (string= type "file") (file-name-absolute-p raw-path)) (concat "file:" raw-path)) (t raw-path))) - (email (if (string= type "mailto") - (let ((text (replace-regexp-in-string - "@" "@@" raw-path))) - (concat text (if desc (concat "," desc)))))) protocol) (cond - ;; Links pointing to a headline: Find destination and build - ;; appropriate referencing command. - ((member type '("custom-id" "id")) - (let ((destination (org-export-resolve-id-link link info))) + ((equal type "radio") + (let ((destination (org-export-resolve-radio-link link info))) + (if (not destination) desc + (format "@ref{%s,,%s}" + (org-texinfo--get-node destination info) + desc)))) + ((member type '("custom-id" "id" "fuzzy")) + (let ((destination + (if (equal type "fuzzy") + (org-export-resolve-fuzzy-link link info) + (org-export-resolve-id-link link info)))) (case (org-element-type destination) + ((nil) + (format org-texinfo-link-with-unknown-path-format + (org-texinfo--sanitize-content path))) ;; Id link points to an external file. (plain-text (if desc (format "@uref{file://%s,%s}" destination desc) (format "@uref{file://%s}" destination))) - ;; LINK points to a headline. Use the headline as the NODE target (headline (format "@ref{%s,%s}" (org-texinfo--get-node destination info) - (or desc ""))) + (cond + (desc) + ((org-export-numbered-headline-p destination info) + (org-export-data + (org-element-property :title destination) info)) + (t + (mapconcat + #'number-to-string + (org-export-get-headline-number destination info) "."))))) (otherwise - (let ((path (org-export-solidify-link-text path))) - (if (not desc) (format "@ref{%s}" path) - (format "@ref{%s,,%s}" path desc))))))) - ((member type '("info")) + (let ((topic + (or desc + (if (and (eq (org-element-type destination) 'headline) + (not (org-export-numbered-headline-p + destination info))) + (org-export-data + (org-element-property :title destination) info)) + (let ((n (org-export-get-ordinal destination info))) + (cond + ((not n) nil) + ((integerp n) n) + (t (mapconcat #'number-to-string n "."))))))) + (when topic + (format "@ref{%s,,%s}" + (org-texinfo--get-node destination info) + topic))))))) + ((equal type "info") (let* ((info-path (split-string path "[:#]")) (info-manual (car info-path)) (info-node (or (cadr info-path) "top")) (title (or desc ""))) (format "@ref{%s,%s,,%s,}" info-node title info-manual))) - ((member type '("fuzzy")) - (let ((destination (org-export-resolve-fuzzy-link link info))) - (case (org-element-type destination) - ;; Id link points to an external file. - (plain-text - (if desc (format "@uref{file://%s,%s}" destination desc) - (format "@uref{file://%s}" destination))) - ;; LINK points to a headline. Use the headline as the NODE target - (headline - (format "@ref{%s,%s}" - (org-texinfo--get-node destination info) - (or desc ""))) - (otherwise - (let ((path (org-export-solidify-link-text path))) - (if (not desc) (format "@ref{%s}" path) - (format "@ref{%s,,%s}" path desc))))))) - ;; Special case for email addresses - (email - (format "@email{%s}" email)) + ((string= type "mailto") + (format "@email{%s}" + (concat (org-texinfo--sanitize-content path) + (and desc (concat "," desc))))) + ((let ((protocol (nth 2 (assoc type org-link-protocols)))) + (and (functionp protocol) + (funcall protocol (org-link-unescape path) desc 'texinfo)))) ;; External link with a description part. ((and path desc) (format "@uref{%s,%s}" path desc)) ;; External link without a description part. @@ -1282,27 +1009,97 @@ (t (format org-texinfo-link-with-unknown-path-format desc))))) -;;; Menu - -(defun org-texinfo-make-menu (info level) - "Create the menu for inclusion in the texifo document. - -INFO is the parsed buffer that contains the headlines. LEVEL -determines whether to make the main menu, or the detailed menu. - -This is only used for generating the primary menu. In-Node menus -are generated directly." - (let ((parse (plist-get info :parse-tree))) - (cond - ;; Generate the main menu - ((eq level 'main) (org-texinfo--build-menu parse 1 info)) - ;; Generate the detailed (recursive) menu - ((eq level 'detailed) - ;; Requires recursion - ;;(org-texinfo--build-detailed-menu parse top info) - (org-texinfo--build-menu parse 1 info 'detailed))))) - -;;; Paragraph +;;;; Menu + +(defun org-texinfo-make-menu (scope info &optional master) + "Create the menu for inclusion in the Texinfo document. + +SCOPE is a headline or a full parse tree. INFO is the +communication channel, as a plist. + +When optional argument MASTER is non-nil, generate a master menu, +including detailed node listing." + (let ((menu (org-texinfo--build-menu scope info))) + (when (org-string-nw-p menu) + (org-element-normalize-string + (format + "@menu\n%s@end menu" + (concat menu + (when master + (let ((detailmenu + (org-texinfo--build-menu + scope info + (let ((toc-depth (plist-get info :with-toc))) + (if (wholenump toc-depth) toc-depth + org-texinfo-max-toc-depth))))) + (when (org-string-nw-p detailmenu) + (concat "\n@detailmenu\n" + "--- The Detailed Node Listing ---\n\n" + detailmenu + "@end detailmenu\n")))))))))) + +(defun org-texinfo--build-menu (scope info &optional level) + "Build menu for entries within SCOPE. +SCOPE is a headline or a full parse tree. INFO is a plist +containing contextual information. When optional argument LEVEL +is an integer, build the menu recursively, down to this depth." + (cond + ((not level) + (org-texinfo--format-entries (org-texinfo--menu-entries scope info) info)) + ((zerop level) nil) + (t + (org-element-normalize-string + (mapconcat + (lambda (h) + (let ((entries (org-texinfo--menu-entries h info))) + (when entries + (concat + (format "%s\n\n%s\n" + (org-export-data (org-export-get-alt-title h info) info) + (org-texinfo--format-entries entries info)) + (org-texinfo--build-menu h info (1- level)))))) + (org-texinfo--menu-entries scope info) ""))))) + +(defun org-texinfo--format-entries (entries info) + "Format all direct menu entries in SCOPE, as a string. +SCOPE is either a headline or a full Org document. INFO is +a plist containing contextual information." + (org-element-normalize-string + (mapconcat + (lambda (h) + (let* ((title (org-export-data + (org-export-get-alt-title h info) info)) + (node (org-texinfo--get-node h info)) + (entry (concat "* " title ":" + (if (string= title node) ":" + (concat " " node ". ")))) + (desc (org-element-property :DESCRIPTION h))) + (if (not desc) entry + (format (format "%%-%ds %%s" org-texinfo-node-description-column) + entry desc)))) + entries "\n"))) + +(defun org-texinfo--menu-entries (scope info) + "List direct children in SCOPE needing a menu entry. +SCOPE is a headline or a full parse tree. INFO is a plist +holding contextual information." + (let* ((cache (or (plist-get info :texinfo-entries-cache) + (plist-get (plist-put info :texinfo-entries-cache + (make-hash-table :test #'eq)) + :texinfo-entries-cache))) + (cached-entries (gethash scope cache 'no-cache))) + (if (not (eq cached-entries 'no-cache)) cached-entries + (puthash scope + (org-element-map (org-element-contents scope) 'headline + (lambda (h) + (and (not (org-not-nil (org-element-property :COPYING h))) + (not (org-element-property :footnote-section-p h)) + (not (org-export-low-level-p h info)) + h)) + info nil 'headline) + cache)))) + +;;;; Paragraph (defun org-texinfo-paragraph (paragraph contents info) "Transcode a PARAGRAPH element from Org to Texinfo. @@ -1310,32 +1107,27 @@ the plist used as a communication channel." contents) -;;; Plain List +;;;; Plain List (defun org-texinfo-plain-list (plain-list contents info) "Transcode a PLAIN-LIST element from Org to Texinfo. CONTENTS is the contents of the list. INFO is a plist holding contextual information." (let* ((attr (org-export-read-attribute :attr_texinfo plain-list)) - (indic (or (plist-get attr :indic) - org-texinfo-def-table-markup)) + (indic (or (plist-get attr :indic) org-texinfo-def-table-markup)) + (table-type (plist-get attr :table-type)) (type (org-element-property :type plain-list)) - (table-type (plist-get attr :table-type)) - ;; Ensure valid texinfo table type. - (table-type (if (member table-type '("ftable" "vtable")) table-type - "table")) (list-type (cond ((eq type 'ordered) "enumerate") ((eq type 'unordered) "itemize") - ((eq type 'descriptive) table-type)))) - (format "@%s%s\n@end %s" - (if (eq type 'descriptive) - (concat list-type " " indic) - list-type) + ((member table-type '("ftable" "vtable")) table-type) + (t "table")))) + (format "@%s\n%s@end %s" + (if (eq type 'descriptive) (concat list-type " " indic) list-type) contents list-type))) -;;; Plain Text +;;;; Plain Text (defun org-texinfo-plain-text (text info) "Transcode a TEXT string from Org to Texinfo. @@ -1366,7 +1158,7 @@ ;; Return value. output)) -;;; Planning +;;;; Planning (defun org-texinfo-planning (planning contents info) "Transcode a PLANNING element from Org to Texinfo. @@ -1402,7 +1194,7 @@ " ") "@*")) -;;; Property Drawer +;;;; Property Drawer (defun org-texinfo-property-drawer (property-drawer contents info) "Transcode a PROPERTY-DRAWER element from Org to Texinfo. @@ -1412,7 +1204,7 @@ ;; lines nonetheless. "") -;;; Quote Block +;;;; Quote Block (defun org-texinfo-quote-block (quote-block contents info) "Transcode a QUOTE-BLOCK element from Org to Texinfo. @@ -1424,7 +1216,7 @@ (format " %s" title))))) (format "%s\n%s@end quotation" start-quote contents))) -;;; Quote Section +;;;; Quote Section (defun org-texinfo-quote-section (quote-section contents info) "Transcode a QUOTE-SECTION element from Org to Texinfo. @@ -1433,7 +1225,7 @@ (org-element-property :value quote-section)))) (when value (format "@verbatim\n%s@end verbatim" value)))) -;;; Radio Target +;;;; Radio Target (defun org-texinfo-radio-target (radio-target text info) "Transcode a RADIO-TARGET object from Org to Texinfo. @@ -1444,15 +1236,17 @@ (org-element-property :value radio-target)) text)) -;;; Section +;;;; Section (defun org-texinfo-section (section contents info) "Transcode a SECTION element from Org to Texinfo. CONTENTS holds the contents of the section. INFO is a plist holding contextual information." - contents) + (concat contents + (let ((parent (org-export-get-parent-headline section))) + (and parent (org-texinfo-make-menu parent info))))) -;;; Special Block +;;;; Special Block (defun org-texinfo-special-block (special-block contents info) "Transcode a SPECIAL-BLOCK element from Org to Texinfo. @@ -1460,34 +1254,26 @@ as a communication channel." contents) -;;; Src Block +;;;; Src Block (defun org-texinfo-src-block (src-block contents info) "Transcode a SRC-BLOCK element from Org to Texinfo. CONTENTS holds the contents of the item. INFO is a plist holding contextual information." - (let* ((lang (org-element-property :language src-block)) - (lisp-p (string-match-p "lisp" lang)) - (src-contents (org-texinfo--sanitize-content - (org-export-format-code-default src-block info)))) - (cond - ;; Case 1. Lisp Block - (lisp-p - (format "@lisp\n%s@end lisp" - src-contents)) - ;; Case 2. Other blocks - (t - (format "@example\n%s@end example" - src-contents))))) + (let ((lispp (org-string-match-p "lisp" + (org-element-property :language src-block))) + (code (org-texinfo--sanitize-content + (org-export-format-code-default src-block info)))) + (format (if lispp "@lisp\n%s@end lisp" "@example\n%s@end example") code))) -;;; Statistics Cookie +;;;; Statistics Cookie (defun org-texinfo-statistics-cookie (statistics-cookie contents info) "Transcode a STATISTICS-COOKIE object from Org to Texinfo. CONTENTS is nil. INFO is a plist holding contextual information." (org-element-property :value statistics-cookie)) -;;; Subscript +;;;; Subscript (defun org-texinfo-subscript (subscript contents info) "Transcode a SUBSCRIPT object from Org to Texinfo. @@ -1495,7 +1281,7 @@ contextual information." (format "@math{_%s}" contents)) -;;; Superscript +;;;; Superscript (defun org-texinfo-superscript (superscript contents info) "Transcode a SUPERSCRIPT object from Org to Texinfo. @@ -1503,96 +1289,47 @@ contextual information." (format "@math{^%s}" contents)) -;;; Table -;; -;; `org-texinfo-table' is the entry point for table transcoding. It -;; takes care of tables with a "verbatim" attribute. Otherwise, it -;; delegates the job to either `org-texinfo-table--table.el-table' or -;; `org-texinfo-table--org-table' functions, depending of the type of -;; the table. -;; -;; `org-texinfo-table--align-string' is a subroutine used to build -;; alignment string for Org tables. +;;;; Table (defun org-texinfo-table (table contents info) "Transcode a TABLE element from Org to Texinfo. CONTENTS is the contents of the table. INFO is a plist holding contextual information." - (cond - ;; Case 1: verbatim table. - ((or org-texinfo-tables-verbatim - (let ((attr (mapconcat 'identity - (org-element-property :attr_latex table) - " "))) - (and attr (string-match "\\" attr)))) - (format "@verbatim \n%s\n@end verbatim" - ;; Re-create table, without affiliated keywords. - (org-trim - (org-element-interpret-data - `(table nil ,@(org-element-contents table)))))) - ;; Case 2: table.el table. Convert it using appropriate tools. - ((eq (org-element-property :type table) 'table.el) - (org-texinfo-table--table.el-table table contents info)) - ;; Case 3: Standard table. - (t (org-texinfo-table--org-table table contents info)))) + (if (eq (org-element-property :type table) 'table.el) + (format "@verbatim\n%s@end verbatim" + (org-element-normalize-string + (org-element-property :value table))) + (let* ((col-width (org-export-read-attribute :attr_texinfo table :columns)) + (columns + (if col-width (format "@columnfractions %s" col-width) + (org-texinfo-table-column-widths table info)))) + (format "@multitable %s\n%s@end multitable" + columns + contents)))) (defun org-texinfo-table-column-widths (table info) "Determine the largest table cell in each column to process alignment. - TABLE is the table element to transcode. INFO is a plist used as a communication channel." - (let* ((rows (org-element-map table 'table-row 'identity info)) - (collected (loop for row in rows collect - (org-element-map row 'table-cell 'identity info))) - (number-cells (length (car collected))) - cells counts) - (loop for row in collected do - (push (mapcar (lambda (ref) - (let* ((start (org-element-property :contents-begin ref)) - (end (org-element-property :contents-end ref)) - (length (- end start))) - length)) row) cells)) - (setq cells (org-remove-if 'null cells)) - (push (loop for count from 0 to (- number-cells 1) collect - (loop for item in cells collect - (nth count item))) counts) - (mapconcat (lambda (size) - (make-string size ?a)) (mapcar (lambda (ref) - (apply 'max `(,@ref))) (car counts)) - "} {"))) - -(defun org-texinfo-table--org-table (table contents info) - "Return appropriate Texinfo code for an Org table. - -TABLE is the table type element to transcode. CONTENTS is its -contents, as a string. INFO is a plist used as a communication -channel. - -This function assumes TABLE has `org' as its `:type' attribute." - (let* ((attr (org-export-read-attribute :attr_texinfo table)) - (col-width (plist-get attr :columns)) - (columns (if col-width - (format "@columnfractions %s" - col-width) - (format "{%s}" - (org-texinfo-table-column-widths - table info))))) - ;; Prepare the final format string for the table. - (cond - ;; Longtable. - ;; Others. - (t (concat - (format "@multitable %s\n%s@end multitable" - columns - contents)))))) - -(defun org-texinfo-table--table.el-table (table contents info) - "Returns nothing. - -Rather than return an invalid table, nothing is returned." - 'nil) - -;;; Table Cell + (let ((widths (make-vector (cdr (org-export-table-dimensions table info)) 0))) + (org-element-map table 'table-row + (lambda (row) + (let ((idx 0)) + (org-element-map row 'table-cell + (lambda (cell) + ;; Length of the cell in the original buffer is only an + ;; approximation of the length of the cell in the + ;; output. It can sometimes fail (e.g. it considers + ;; "/a/" being larger than "ab"). + (let ((w (- (org-element-property :contents-end cell) + (org-element-property :contents-begin cell)))) + (aset widths idx (max w (aref widths idx)))) + (incf idx)) + info))) + info) + (format "{%s}" (mapconcat (lambda (w) (make-string w ?a)) widths "} {")))) + +;;;; Table Cell (defun org-texinfo-table-cell (table-cell contents info) "Transcode a TABLE-CELL element from Org to Texinfo. @@ -1609,7 +1346,7 @@ contents) (when (org-export-get-next-element table-cell info) "\n@tab "))) -;;; Table Row +;;;; Table Row (defun org-texinfo-table-row (table-row contents info) "Transcode a TABLE-ROW element from Org to Texinfo. @@ -1618,21 +1355,15 @@ ;; Rules are ignored since table separators are deduced from ;; borders of the current row. (when (eq (org-element-property :type table-row) 'standard) - (let ((rowgroup-tag - (cond - ;; Case 1: Belongs to second or subsequent rowgroup. - ((not (= 1 (org-export-table-row-group table-row info))) - "@item ") - ;; Case 2: Row is from first rowgroup. Table has >=1 rowgroups. - ((org-export-table-has-header-p - (org-export-get-parent-table table-row) info) - "@headitem ") - ;; Case 3: Row is from first and only row group. - (t "@item ")))) - (when (eq (org-element-property :type table-row) 'standard) - (concat rowgroup-tag contents "\n"))))) + (let ((rowgroup-tag + (if (and (= 1 (org-export-table-row-group table-row info)) + (org-export-table-has-header-p + (org-export-get-parent-table table-row) info)) + "@headitem " + "@item "))) + (concat rowgroup-tag contents "\n")))) -;;; Target +;;;; Target (defun org-texinfo-target (target contents info) "Transcode a TARGET object from Org to Texinfo. @@ -1641,7 +1372,7 @@ (format "@anchor{%s}" (org-export-solidify-link-text (org-element-property :value target)))) -;;; Timestamp +;;;; Timestamp (defun org-texinfo-timestamp (timestamp contents info) "Transcode a TIMESTAMP object from Org to Texinfo. @@ -1656,7 +1387,7 @@ (format org-texinfo-inactive-timestamp-format value)) (t (format org-texinfo-diary-timestamp-format value))))) -;;; Verbatim +;;;; Verbatim (defun org-texinfo-verbatim (verbatim contents info) "Transcode a VERBATIM object from Org to Texinfo. @@ -1664,26 +1395,13 @@ channel." (org-texinfo--text-markup (org-element-property :value verbatim) 'verbatim)) -;;; Verse Block +;;;; Verse Block (defun org-texinfo-verse-block (verse-block contents info) "Transcode a VERSE-BLOCK element from Org to Texinfo. CONTENTS is verse block contents. INFO is a plist holding contextual information." - ;; In a verse environment, add a line break to each newline - ;; character and change each white space at beginning of a line - ;; into a space of 1 em. Also change each blank line with - ;; a vertical space of 1 em. - (progn - (setq contents (replace-regexp-in-string - "^ *\\\\\\\\$" "\\\\vspace*{1em}" - (replace-regexp-in-string - "\\(\\\\\\\\\\)?[ \t]*\n" " \\\\\\\\\n" contents))) - (while (string-match "^[ \t]+" contents) - (let ((new-str (format "\\hspace*{%dem}" - (length (match-string 0 contents))))) - (setq contents (replace-match new-str nil t contents)))) - (format "\\begin{verse}\n%s\\end{verse}" contents))) + (format "@display\n%s@end display" contents)) ;;; Interactive functions @@ -1797,29 +1515,21 @@ errors) (message (format "Processing Texinfo file %s..." file)) (save-window-excursion - (cond - ;; A function is provided: Apply it. - ((functionp org-texinfo-info-process) - (funcall org-texinfo-info-process (shell-quote-argument file))) - ;; A list is provided: Replace %b, %f and %o with appropriate - ;; values in each command before applying it. Output is - ;; redirected to "*Org INFO Texinfo Output*" buffer. - ((consp org-texinfo-info-process) - (let ((outbuf (get-buffer-create "*Org INFO Texinfo Output*"))) - (mapc - (lambda (command) - (shell-command - (replace-regexp-in-string - "%b" (shell-quote-argument base-name) - (replace-regexp-in-string - "%f" (shell-quote-argument full-name) - (replace-regexp-in-string - "%o" (shell-quote-argument out-dir) command t t) t t) t t) - outbuf)) - org-texinfo-info-process) - ;; Collect standard errors from output buffer. - (setq errors (org-texinfo-collect-errors outbuf)))) - (t (error "No valid command to process to Info"))) + ;; Replace %b, %f and %o with appropriate values in each command + ;; before applying it. Output is redirected to "*Org INFO + ;; Texinfo Output*" buffer. + (let ((outbuf (get-buffer-create "*Org INFO Texinfo Output*"))) + (dolist (command org-texinfo-info-process) + (shell-command + (replace-regexp-in-string + "%b" (shell-quote-argument base-name) + (replace-regexp-in-string + "%f" (shell-quote-argument full-name) + (replace-regexp-in-string + "%o" (shell-quote-argument out-dir) command t t) t t) t t) + outbuf)) + ;; Collect standard errors from output buffer. + (setq errors (org-texinfo-collect-errors outbuf))) (let ((infofile (concat out-dir base-name ".info"))) ;; Check for process failure. Provide collected errors if ;; possible. === modified file 'lisp/org/ox.el' --- lisp/org/ox.el 2014-04-22 14:07:45 +0000 +++ lisp/org/ox.el 2014-10-03 08:13:51 +0000 @@ -814,7 +814,7 @@ (defcustom org-export-show-temporary-export-buffer t "Non-nil means show buffer after exporting to temp buffer. -When Org exports to a file, the buffer visiting that file is ever +When Org exports to a file, the buffer visiting that file is never shown, but remains buried. However, when exporting to a temporary buffer, that buffer is popped up in a second window. When this variable is nil, the buffer remains buried also in @@ -1317,6 +1317,10 @@ ;; - category :: tree ;; - type :: list of elements and objects ;; +;; + `:input-buffer' :: Name of input buffer. +;; - category :: option +;; - type :: string +;; ;; + `:input-file' :: Full path to input file, if any. ;; - category :: option ;; - type :: string or nil @@ -1329,6 +1333,10 @@ ;; - category :: option ;; - type :: string ;; +;; + `:output-file' :: Full path to output file, if any. +;; - category :: option +;; - type :: string or nil +;; ;; + `:parse-tree' :: Whole parse tree, available at any time during ;; transcoding. ;; - category :: option @@ -1765,17 +1773,19 @@ (when (stringp value) (setq plist (plist-put plist property - (org-element-parse-secondary-string - value (org-element-restriction 'keyword)))))))))) + (or (org-element-parse-secondary-string + value (org-element-restriction 'keyword)) + ;; When TITLE keyword sets an empty + ;; string, make sure it doesn't + ;; appear as nil in the plist. + (and (eq property :title) "")))))))))) (defun org-export--get-buffer-attributes () "Return properties related to buffer attributes, as a plist." ;; Store full path of input file name, or nil. For internal use. (let ((visited-file (buffer-file-name (buffer-base-buffer)))) (list :input-file visited-file - :title (if (not visited-file) (buffer-name (buffer-base-buffer)) - (file-name-sans-extension - (file-name-nondirectory visited-file)))))) + :input-buffer (buffer-name (buffer-base-buffer))))) (defun org-export--get-global-options (&optional backend) "Return global export options as a plist. @@ -1788,23 +1798,22 @@ (all (append (and backend (org-export-get-all-options backend)) org-export-options-alist))) (dolist (cell all plist) - (let ((prop (car cell)) - (default-value (nth 3 cell))) - (unless (or (not default-value) (plist-member plist prop)) + (let ((prop (car cell))) + (unless (plist-member plist prop) (setq plist (plist-put plist prop - ;; Eval default value provided. If keyword is + ;; Evaluate default value provided. If keyword is ;; a member of `org-element-document-properties', ;; parse it as a secondary string before storing it. (let ((value (eval (nth 3 cell)))) - (if (not (stringp value)) value - (let ((keyword (nth 1 cell))) - (if (member keyword org-element-document-properties) - (org-element-parse-secondary-string - value (org-element-restriction 'keyword)) - value))))))))))) + (if (and (stringp value) + (member (nth 1 cell) + org-element-document-properties)) + (org-element-parse-secondary-string + value (org-element-restriction 'keyword)) + value))))))))) (defun org-export--list-bound-variables () "Return variables bound from BIND keywords in current buffer. @@ -1843,6 +1852,13 @@ ;; Return value in appropriate order of appearance. (nreverse (funcall collect-bind nil nil))))) +;; defsubst org-export-get-parent must be defined before first use, +;; was originally defined in the topology section + +(defsubst org-export-get-parent (blob) + "Return BLOB parent or nil. +BLOB is the element or object considered." + (org-element-property :parent blob)) ;;;; Tree Properties ;; @@ -2146,9 +2162,8 @@ DATA is a parse tree, an element or an object or a secondary string. INFO is a plist holding export options. -Return transcoded string." - (let ((memo (gethash data (plist-get info :exported-data) 'no-memo))) - (if (not (eq memo 'no-memo)) memo +Return a string." + (or (gethash data (plist-get info :exported-data)) (let* ((type (org-element-type data)) (results (cond @@ -2174,9 +2189,9 @@ ;; Secondary string. ((not type) (mapconcat (lambda (obj) (org-export-data obj info)) data "")) - ;; Element/Object without contents or, as a special case, - ;; headline with archive tag and archived trees restricted - ;; to title only. + ;; Element/Object without contents or, as a special + ;; case, headline with archive tag and archived trees + ;; restricted to title only. ((or (not (org-element-contents data)) (and (eq type 'headline) (eq (plist-get info :with-archived-trees) 'headline) @@ -2201,16 +2216,16 @@ (lambda (element) (org-export-data element info)) (org-element-contents (if (or greaterp objectp) data - ;; Elements directly containing objects - ;; must have their indentation normalized - ;; first. + ;; Elements directly containing + ;; objects must have their indentation + ;; normalized first. (org-element-normalize-contents data - ;; When normalizing contents of the first - ;; paragraph in an item or a footnote - ;; definition, ignore first line's - ;; indentation: there is none and it - ;; might be misleading. + ;; When normalizing contents of the + ;; first paragraph in an item or + ;; a footnote definition, ignore + ;; first line's indentation: there is + ;; none and it might be misleading. (when (eq type 'paragraph) (let ((parent (org-export-get-parent data))) (and @@ -2227,10 +2242,10 @@ (puthash data (cond - ((not results) nil) + ((not results) "") ((memq type '(org-data plain-text nil)) results) - ;; Append the same white space between elements or objects as in - ;; the original buffer, and call appropriate filters. + ;; Append the same white space between elements or objects + ;; as in the original buffer, and call appropriate filters. (t (let ((results (org-export-filter-apply-functions @@ -2240,10 +2255,10 @@ (if (memq type org-element-all-elements) (concat (org-element-normalize-string results) (make-string post-blank ?\n)) - (concat results (make-string post-blank ? )))) + (concat results (make-string post-blank ?\s)))) info))) results))) - (plist-get info :exported-data)))))) + (plist-get info :exported-data))))) (defun org-export-data-with-backend (data backend info) "Convert DATA into BACKEND format. @@ -3011,6 +3026,14 @@ (org-export-install-filters (org-combine-plists info (org-export-get-environment backend subtreep ext-plist)))) + ;; Special case: provide original file name or buffer name as + ;; default value for :title property. + (unless (plist-get info :title) + (plist-put + info :title + (let ((file (plist-get info :input-file))) + (if file (file-name-sans-extension (file-name-nondirectory file)) + (plist-get info :input-buffer))))) ;; Expand export-specific set of macros: {{{author}}}, ;; {{{date}}}, {{{email}}} and {{{title}}}. It must be done ;; once regular macros have been expanded, since document @@ -5106,11 +5129,7 @@ ;; `org-export-get-genealogy' returns the full genealogy of a given ;; element or object, from closest parent to full parse tree. -(defsubst org-export-get-parent (blob) - "Return BLOB parent or nil. -BLOB is the element or object considered." - (org-element-property :parent blob)) - +;; defsubst org-export-get-parent must be defined before first use (defun org-export-get-genealogy (blob) "Return full genealogy relative to a given element or object. @@ -5638,7 +5657,8 @@ or FILE." (declare (indent 2)) (if (not (file-writable-p file)) (error "Output file not writable") - (let ((encoding (or org-export-coding-system buffer-file-coding-system))) + (let ((ext-plist (org-combine-plists `(:output-file ,file) ext-plist)) + (encoding (or org-export-coding-system buffer-file-coding-system))) (if async (org-export-async-start `(lambda (file) === modified file 'lisp/vc/vc-svn.el' --- lisp/vc/vc-svn.el 2014-01-01 07:43:34 +0000 +++ lisp/vc/vc-svn.el 2014-10-03 13:15:05 +0000 @@ -195,7 +195,7 @@ (?~ . edited))) (re (if remote "^\\(.\\)\\(.\\).....? \\([ *]\\) +\\(?:[-0-9]+\\)? \\(.*\\)$" ;; Subexp 3 is a dummy in this case, so the numbers match. - "^\\(.\\)\\(.\\)...\\(.\\) \\(.*\\)$")) + "^\\(.\\)\\(.\\)...\\(.\\).? \\(.*\\)$")) result) (goto-char (point-min)) (while (re-search-forward re nil t) @@ -354,14 +354,23 @@ (concat "-r" rev)) (vc-switches 'SVN 'checkout)))) -(defun vc-svn-ignore (file &optional _directory _remove) +(defun vc-svn-ignore (file &optional directory remove) "Ignore FILE under Subversion. FILE is a file wildcard, relative to the root directory of DIRECTORY." - (vc-svn-command t 0 file "propedit" "svn:ignore")) + (let* ((ignores (vc-svn-ignore-completion-table directory)) + (file (file-relative-name file directory)) + (ignores (if remove + (delete file ignores) + (push file ignores)))) + (vc-svn-command nil 0 nil nil "propset" "svn:ignore" + (mapconcat #'identity ignores "\n") + (expand-file-name directory)))) -(defun vc-svn-ignore-completion-table (_file) - "Return the list of ignored files." - ) +(defun vc-svn-ignore-completion-table (directory) + "Return the list of ignored files in DIRECTORY." + (with-temp-buffer + (vc-svn-command t t nil "propget" "svn:ignore" (expand-file-name directory)) + (split-string (buffer-string)))) (defun vc-svn-find-admin-dir (file) "Return the administrative directory of FILE." === modified file 'src/ChangeLog' --- src/ChangeLog 2014-10-03 05:31:17 +0000 +++ src/ChangeLog 2014-10-03 15:44:46 +0000 @@ -1,5 +1,16 @@ 2014-10-03 Dmitry Antipov + * font.c (font_list_entities): Do not add empty vector to font cache. + (font_matching_entity): Likewise. If matching entity is found, insert + 1-item vector with this entity instead of an entity itself (Bug#17125). + +2014-10-03 Eli Zaretskii + + * xdisp.c (move_it_by_lines): Call reseat_1 after moving the + iterator backwards, to resync the bidi iterator. (Bug#18584) + +2014-10-03 Dmitry Antipov + Consistently use min and max macros from lisp.h. * coding.c (min, max): * font.c (MAX): === modified file 'src/xdisp.c' --- src/xdisp.c 2014-10-01 03:28:16 +0000 +++ src/xdisp.c 2014-10-03 15:44:46 +0000 @@ -9752,6 +9752,7 @@ back_to_previous_visible_line_start (it); it->vpos--; } + reseat_1 (it, it->current.pos, 1); } else RESTORE_IT (it, it, it2data); ------------------------------------------------------------ revno: 118026 committer: Eli Zaretskii branch nick: trunk timestamp: Fri 2014-10-03 16:02:53 +0300 message: doc/misc/erc.texi (Connecting): Remove stray "OA" that failed the manual build. diff: === modified file 'doc/misc/ChangeLog' --- doc/misc/ChangeLog 2014-10-03 12:13:31 +0000 +++ doc/misc/ChangeLog 2014-10-03 13:02:53 +0000 @@ -1,3 +1,8 @@ +2014-10-03 Eli Zaretskii + + * erc.texi (Connecting): Remove stray "OA" that failed the manual + build. + 2014-10-03 Kelvin White * erc.texi (Advanced Usage, Options): Add descriptions and examples === modified file 'doc/misc/erc.texi' --- doc/misc/erc.texi 2014-10-03 12:13:31 +0000 +++ doc/misc/erc.texi 2014-10-03 13:02:53 +0000 @@ -591,7 +591,7 @@ @defopt erc-format-nick-function A function to format a nickname for message display -You can set this to @code{erc-format-@OA@nick} to display user mode prefix +You can set this to @code{erc-format-@@nick} to display user mode prefix @end defopt @example ------------------------------------------------------------ revno: 118025 committer: Kelvin White branch nick: trunk timestamp: Fri 2014-10-03 08:13:31 -0400 message: Updating ERC documentation diff: === modified file 'doc/misc/ChangeLog' --- doc/misc/ChangeLog 2014-09-26 00:15:21 +0000 +++ doc/misc/ChangeLog 2014-10-03 12:13:31 +0000 @@ -1,3 +1,8 @@ +2014-10-03 Kelvin White + + * erc.texi (Advanced Usage, Options): Add descriptions and examples + for erc-format-nick-function and erc-rename-buffers options. + 2014-09-26 Leo Liu * cl.texi (Predicates on Numbers): Document cl-digit-char-p. === modified file 'doc/misc/erc.texi' --- doc/misc/erc.texi 2014-06-10 02:20:31 +0000 +++ doc/misc/erc.texi 2014-10-03 12:13:31 +0000 @@ -588,6 +588,16 @@ other nicks are tried in the list order. @end defopt +@defopt erc-format-nick-function +A function to format a nickname for message display + +You can set this to @code{erc-format-@OA@nick} to display user mode prefix +@end defopt + +@example +(setq erc-format-nick-function 'erc-format-@@nick) +@end example + @defopt erc-nick-uniquifier The string to append to the nick if it is already in use. @end defopt @@ -661,7 +671,8 @@ ;; using the version of ERC that comes with Emacs (add-to-list 'load-path "~/elisp/erc") -;; Load ERC +;; Load ERC -- again, you don't need this if you are using the version +;; of ERC that comes with Emacs (require 'erc) ;; Load authentication info from an external source. Put sensitive @@ -712,6 +723,12 @@ ;; Join the #emacs and #erc channels whenever connecting to Freenode. (setq erc-autojoin-channels-alist '(("freenode.net" "#emacs" "#erc"))) +;; Rename server buffers to reflect the current network name instead +;; of IP:PORT. (e.g. "freenode" instead of "84.240.3.129:6667"). This +;; is useful when using a bouncer like ZNC where you have multiple +;; connections to the same server. +(setq erc-rename-buffers t) + ;; Interpret mIRC-style color commands in IRC chats (setq erc-interpret-mirc-color t) @@ -750,6 +767,14 @@ nickname is considered a lurker. @end defopt +@defopt erc-rename-buffers +If non, @code{nil}, this will rename server buffers to reflect the +current network name instead of IP:PORT + +@example +(setq erc-rename-buffers t) +@end example +@end defopt @node Getting Help and Reporting Bugs @chapter Getting Help and Reporting Bugs ------------------------------------------------------------ revno: 118024 committer: Kelvin White branch nick: trunk timestamp: Fri 2014-10-03 07:08:37 -0400 message: erc.el (erc-rename-buffers): Use defcustom instead of defvar. diff: === modified file 'lisp/erc/ChangeLog' --- lisp/erc/ChangeLog 2014-10-02 19:28:26 +0000 +++ lisp/erc/ChangeLog 2014-10-03 11:08:37 +0000 @@ -1,3 +1,8 @@ +2014-10-03 Kelvin White + + * erc.el (erc-rename-buffers): Use defcustom instead of defvar for + buffer renaming configuration option. + 2014-10-02 Paul Eggert * erc.el (erc-nick-at-point): Fix format-string typo (Bug#17755). === modified file 'lisp/erc/erc.el' --- lisp/erc/erc.el 2014-10-02 19:28:26 +0000 +++ lisp/erc/erc.el 2014-10-03 11:08:37 +0000 @@ -196,6 +196,11 @@ :set (lambda (sym val) (set sym (if (functionp val) (funcall val) val)))) +(defcustom erc-rename-buffers nil + "When this is set to t, buffers will be renamed to network name if available" + :group 'erc + :type 'boolean) + (defvar erc-password nil "Password to use when authenticating to an IRC server. It is not strictly necessary to provide this, since ERC will @@ -1792,10 +1797,6 @@ "Used to keep track of how many times an attempt at changing nick is made.") (make-variable-buffer-local 'erc-nick-change-attempt-count) -(defvar erc-rename-buffer-p nil - "When this is set to t, buffers will be renamed to network name if available") -(make-variable-buffer-local 'erc-rename-buffer-p) - (defun erc-migrate-modules (mods) "Migrate old names of ERC modules to new ones." ;; modify `transforms' to specify what needs to be changed @@ -6231,7 +6232,7 @@ "@" network-name)) ((and network-name (not (get-buffer network-name))) - (when erc-rename-buffer-p + (when erc-rename-buffers (rename-buffer network-name)) network-name) (t (buffer-name (current-buffer)))))) ------------------------------------------------------------ revno: 118023 committer: Dmitry Antipov branch nick: trunk timestamp: Fri 2014-10-03 09:31:17 +0400 message: * fileio.c (emacs_readlinkat, Finsert_file_contents): * w32fns.c, xfns.c (x_create_tip_frame): Use AUTO_STRING. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2014-10-03 04:35:10 +0000 +++ src/ChangeLog 2014-10-03 05:31:17 +0000 @@ -9,6 +9,9 @@ Adjust users. * gmalloc.c (min): Tiny style change. + * fileio.c (emacs_readlinkat, Finsert_file_contents): + * w32fns.c, xfns.c (x_create_tip_frame): Use AUTO_STRING. + 2014-10-03 Paul Eggert Fix x-focus-frame bug with "Not an in-range integer" (Bug#18586). === modified file 'src/fileio.c' --- src/fileio.c 2014-10-01 03:28:16 +0000 +++ src/fileio.c 2014-10-03 05:31:17 +0000 @@ -2691,7 +2691,10 @@ val = build_unibyte_string (buf); if (buf[0] == '/' && strchr (buf, ':')) - val = concat2 (build_unibyte_string ("/:"), val); + { + AUTO_STRING (slash_colon, "/:"); + val = concat2 (slash_colon, val); + } if (buf != readlink_buf) xfree (buf); val = DECODE_FILE (val); @@ -3645,13 +3648,14 @@ report_file_error ("Read error", orig_filename); else if (nread > 0) { + AUTO_STRING (name, " *code-converting-work*"); struct buffer *prev = current_buffer; Lisp_Object workbuf; struct buffer *buf; record_unwind_current_buffer (); - workbuf = Fget_buffer_create (build_string (" *code-converting-work*")); + workbuf = Fget_buffer_create (name); buf = XBUFFER (workbuf); delete_all_overlays (buf); === modified file 'src/w32fns.c' --- src/w32fns.c 2014-09-30 23:19:31 +0000 +++ src/w32fns.c 2014-10-03 05:31:17 +0000 @@ -5653,7 +5653,8 @@ f->wants_modeline = 0; XSETFRAME (frame, f); - buffer = Fget_buffer_create (build_string (" *tip*")); + AUTO_STRING (tip, " *tip*"); + buffer = Fget_buffer_create (tip); /* Use set_window_buffer instead of Fset_window_buffer (see discussion of bug#11984, bug#12025, bug#12026). */ set_window_buffer (FRAME_ROOT_WINDOW (f), buffer, 0, 0); === modified file 'src/xfns.c' --- src/xfns.c 2014-10-01 03:28:16 +0000 +++ src/xfns.c 2014-10-03 05:31:17 +0000 @@ -4829,7 +4829,8 @@ f = make_frame (1); XSETFRAME (frame, f); - buffer = Fget_buffer_create (build_string (" *tip*")); + AUTO_STRING (tip, " *tip*"); + buffer = Fget_buffer_create (tip); /* Use set_window_buffer instead of Fset_window_buffer (see discussion of bug#11984, bug#12025, bug#12026). */ set_window_buffer (FRAME_ROOT_WINDOW (f), buffer, 0, 0); ------------------------------------------------------------ Use --include-merged or -n0 to see merged revisions.