[texdoc-commits] [SCM] texdoc updated: r18 - in trunk: . script

karl at gnu.org.ua karl at gnu.org.ua
Sun Nov 5 00:32:08 CET 2017


Author: karl
Date: 2017-11-05 01:32:07 +0200 (Sun, 05 Nov 2017)
New Revision: 18

Modified:
   trunk/NEWS
   trunk/script/ChangeLog
   trunk/script/view.tlu
Log:
RET in list mode views first document

Modified: trunk/NEWS
===================================================================
--- trunk/NEWS	2017-10-26 22:37:19 UTC (rev 17)
+++ trunk/NEWS	2017-11-04 23:32:07 UTC (rev 18)
@@ -1,11 +1,15 @@
 $Id$
 (This file public domain.)
 
+- In list mode (-l), just RET views first document in list.
+- --help and --version override other specified command-line actions.
+
 Version 2.017 (TeX Live 2017)
 ============================
 - Restore user's LC_CTYPE value if possible (with this year's luatex).
 - Generic system environment variables, such as BROWSER, accept
   a colon-separated list of programs.
+- Sources moved to https://puszcza.gnu.org.ua/projects/texdoc.
 
 Version 0.85
 ------------

Modified: trunk/script/ChangeLog
===================================================================
--- trunk/script/ChangeLog	2017-10-26 22:37:19 UTC (rev 17)
+++ trunk/script/ChangeLog	2017-11-04 23:32:07 UTC (rev 18)
@@ -1,3 +1,11 @@
+2017-11-04  Karl Berry  <karl at freefriends.org>
+
+* view.tlu (print_menu): make just RET as input view first document in list.
+Suggested by Denis Bitouze,
+http://tug.org/pipermail/texdoc/2017q3/000394.html
+
+Also, quit if number is beyond last in list, even if the document exists.
+
 2017-10-26  Karl Berry  <karl at freefriends.org>
 
 * config.tlu (setup_config_from_cl): return action to take instead of boolean.
@@ -3,9 +11,9 @@
 * main.tlu: change call.
 (action_opts): no longer needed.
-From Reuben Thomas, http://puszcza.gnu.org.ua/bugs/?363.
+From Reuben Thomas, http://puszcza.gnu.org.ua/bugs/?363
 
 2017-10-26  Karl Berry  <karl at freefriends.org>
 
 * search.tlu (get_doclist): do get_doclist_texdocs search last, so
 its (highest priority) tree code is what counts.
-From Reuben Thomas, https://puszcza.gnu.org.ua/bugs/?369.
+From Reuben Thomas, https://puszcza.gnu.org.ua/bugs/?369

Modified: trunk/script/view.tlu
===================================================================
--- trunk/script/view.tlu	2017-10-26 22:37:19 UTC (rev 17)
+++ trunk/script/view.tlu	2017-11-04 23:32:07 UTC (rev 18)
@@ -156,8 +156,9 @@
             end
         end
     end
-    local i, doc
+    local i, doc, last_i
     for i, doc in ipairs (doclist) do
+        last_i = i -- save for test below
         if doc.quality == 'killed' then break end
         if doc.quality ~= 'good' and not showall then break end
         if config.machine_switch == true then
@@ -174,16 +175,20 @@
         end
     end
     if config.interact_switch then
-        io.write ("Please enter the number of the file to view, ",
-        "anything else to skip: ")
-        local num = tonumber(io.read('*line'))
-        if num and doclist[num] then
+        io.write ("Enter number of file to view, ",
+        "RET to view 1, anything else to skip: ")
+        local num_str = io.read('*line')
+        -- That returns the empty string on an empty line, nil on EOF.
+        -- We only want to default to viewing 1 on an empty line.
+        -- Use Lua's faked ternary operator for fun and brevity:
+        num = (num_str == "" and 1 or tonumber(num_str))
+        if num and doclist[num] and num < last_i then
             view_doc(doclist[num])
         end
     end
 end
 
------------------------   deliver results base on mode   ----------------------
+-----------------------   deliver results based on mode   ---------------------
 
 function deliver_results(name, doclist, many)
     -- ensure that results were found or apologize



More information about the texdoc-commits mailing list